The script dumps the pre-defined MySQL database, encrypts it with ccrypt and uploads to a remote FTP server via secure TLS connection.
When done uploading to FTP, the script then downloads the backup file back and calculates md5 hashes for both local and remote backups files. If the values match, then a success email is sent. Otherwise an error message is mailed.
For this script to work on Debian Wheezy, you may need to install the following packages first:
# apt-get update && apt-get install gzip ccrypt ftp-ssl heirloom-mailx
FTP client uses
~/.netrc file for authentication which looks like this:
machine ftp.example.com login ftp_user password ftp_password
MySQL Backup Script to FTPS
Script can be found on the GitHub (you need to have git installed):
$ git clone https://github.com/crylium/crypt-backup-to-ftps.git