These are 2 scripts I wrote to automate the nightly backup of my databases and upload them to a remote location via FTP.
There is a bash script that you call from cron at a time of your choice. This uses mysqldump to make a copy of your database, compress is using pbzip2 (adjust to bzip2 or gzip if you don't have pbzip2 installed), and then calls the upload.pl script to upload the file via FTP to the remote site (keeping 5 rolling days worth of backups).
For my own use, I backup several databases each night, so the perl script is creating an array of file names, and using a foreach loop. If you only have a single database to back up, you can remove the foreach loop, and set the array to be a single variable.
Feel free to adjust to suite your own needs, and I'll try and provide assistance as and where needed.
Download tuoitreit.vn_dbbackup.zip (1.4kb)
There is a bash script that you call from cron at a time of your choice. This uses mysqldump to make a copy of your database, compress is using pbzip2 (adjust to bzip2 or gzip if you don't have pbzip2 installed), and then calls the upload.pl script to upload the file via FTP to the remote site (keeping 5 rolling days worth of backups).
For my own use, I backup several databases each night, so the perl script is creating an array of file names, and using a foreach loop. If you only have a single database to back up, you can remove the foreach loop, and set the array to be a single variable.
Feel free to adjust to suite your own needs, and I'll try and provide assistance as and where needed.
Download tuoitreit.vn_dbbackup.zip (1.4kb)