Created
January 19, 2012 17:19
-
-
Save seanbehan/1641297 to your computer and use it in GitHub Desktop.
Simple Backup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # crontab -e | |
| # 10 3 * * * /root/mysql_backups.sh > ~/backups/status.log | |
| # change DB_USER and DB_PASSWD as per configuration | |
| export DB_BACKUP="~/domains/baks" | |
| export DB_USER="******" | |
| export DB_PASSWD="*****" | |
| export DB_HOST="*****" | |
| echo "" | |
| echo "Backing up all mysql databases" | |
| echo "--------------------------" | |
| echo "* Creating backup..." | |
| mysqldump --user=$DB_USER --password=$DB_PASSWD --all-databases --host=$DB_HOST | bzip2 > ~/data/baks/mysql-`date +%Y-%m`.bz2 | |
| echo "----------------------" | |
| echo "Done" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment