I have this setup on one of my servers. It is a lifesaver. First thing to do is to make a bash script. In the bash script was the following code:
Code:
*!/bin/sh
******
* first make a mysqldump of all databases, and tar and zip it
******
mysqldump --add-drop-table -u user_name -p password --all-databases | tar -vxzf > backup.sql.tar.gz
******
* next email it
* The echo at the start of the last line adds a blank into the body of the
* mail being set out.
******
echo | mutt -a backup.sql.tar.gz -s “daily backup of database” [email protected]
****
* finally, delete the backup from your server
****
rm backup.sql.gz
Secondly chmod +x the script to make it executable,
next, just add a daily cron job to call the script and that's it.
Code:
*!/bin/sh
******
* first make a mysqldump of all databases, and tar and zip it
******
mysqldump --add-drop-table -u user_name -p password --all-databases | tar -vxzf > backup.sql.tar.gz
******
* next email it
* The echo at the start of the last line adds a blank into the body of the
* mail being set out.
******
echo | mutt -a backup.sql.tar.gz -s “daily backup of database” [email protected]
****
* finally, delete the backup from your server
****
rm backup.sql.gz
Secondly chmod +x the script to make it executable,
next, just add a daily cron job to call the script and that's it.