Created
May 6, 2009 16:43
-
-
Save codeprimate/107596 to your computer and use it in GitHub Desktop.
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 | |
# /home/username/bin/backup_db.sh | |
# MySQL Backup | |
DATE=`date "+%y%m%d"` | |
BACKUP_DEST="/home/username/site/production/current/db" | |
DB="database_name" | |
DB_USER="db_user" | |
DB_USER_PW="db_password" | |
DB_BACK=$BACKUP_DEST/$DATE-db.sql.gz | |
/usr/bin/mysqldump --password=$DB_USER_PW -Ke -u $DB_USER $DB | gzip > $DB_BACK | |
#### END |
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 | |
# /home/username/bin/backup_production_site.sh | |
# Client backup script | |
SOURCEPATH='/home/remote_username/site/production/current' | |
DESTPATH='/home/local_username/backups/production_site_backup' | |
SOURCEHOST='production.host' | |
SOURCEUSER='remote_username' | |
LOGFILE='/home/local_username/backups/rsync.log' | |
echo | |
echo " * Running MySQLDump on $SOURCEHOST..." | |
ssh $SOURCEUSER@$SOURCEHOST '/home/remote_username/bin/backup_db.sh' | |
echo " * Syncing Local Backup..." | |
echo >> $LOGFILE | |
rsync -av -e ssh $SOURCEUSER@$SOURCEHOST:$SOURCEPATH $DESTPATH | |
echo "Completed at: `/bin/date`" >> $LOGFILE | |
echo "Done." | |
#### END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment