Created
September 27, 2011 15:10
-
-
Save cearls/1245316 to your computer and use it in GitHub Desktop.
Rackspace Cloud Site backup script
This file contains 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 | |
export ACCOUNT_ROOT="account root" | |
export WEB_ROOT="${ACCOUNT_ROOT}/web/content" | |
export DB_HOST="db host" | |
export DB_USER="db user" | |
export DB_PASSWORD="db password" | |
export DB_NAME="db name" | |
echo "Rotating backups..." | |
rm -rf $WEB_ROOT/backup/02 | |
mv $WEB_ROOT/backup/01 $WEB_ROOT/backup/02 | |
mkdir $WEB_ROOT/backup/01 | |
echo "... done rotating backups." | |
echo "Starting database backup..." | |
mysqldump --host=$DB_HOST --user=$DB_USER --password=$DB_PASSWORD --all-databases | bzip2 > $WEB_ROOT/backup/01/mysql-`date +%Y-%m-%d`.bz2 | |
echo "... database backup complete." | |
echo "Starting file system backup..." | |
tar czf $WEB_ROOT/backup/01/web_backup.tgz $WEB_ROOT --exclude $WEB_ROOT/backup | |
echo "... file system backup complete." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment