I had created a script to backup a production database. My initial approach was to backup the mysql directory itself (/var/lib/mysql) but it was discouraged by other users.
The script is very simple, once the shell script knowledge is very basic.
#!/bin/bash # backup file backupFile="backup_$(date +%d%m%Y_%H%M).sql" # create the backup file using mysqldump /usr/bin/mysqldump -uuser -ppass db > /home/user/db_backups/$backupFile # copy the backup file to the remote server rsync -e ssh -varuzP /home/user/db_backups/ user@remoteserver:/home/user/backup/mysql
First of all, I would like to know your opinion about the script. Second, I would like also to know if rsync somehow checks for a possible file corruption during the transmission between the production server and the remote backup server.
Thanks in advance for the help, Best regards!