Created
September 17, 2015 04:08
-
-
Save jsoningram/e3bfbf58e791bac79509 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 | |
# bckup.sh | |
# requires s3cmd | |
# backup db and site files to backups dir | |
# set variables | |
client='CLIENT' | |
db='DATABASE' | |
dbu='DATABASEUSER' | |
dbpw='PASSWORD' | |
aws='BUCKETFOLDER' | |
wpinstall='INSTALLFOLDER' | |
cd ~/$wpinstall/ | |
dumpfile=$client`date +%F`.sql | |
tarball=$client`date +%F`.tar | |
# run the dump | |
mysqldump --add-drop-table -u $dbu -p$dbpw $db > $dumpfile | |
tar -vcf $tarball --exclude='backupbuddy' --exclude='backupbuddy_backups' --exclude='backups' . | |
rm $dumpfile | |
chmod 750 $tarball | |
mv $tarball ../$wpinstall/backups/ | |
s3cmd put ~/$wpinstall/backups/$tarball s3://mc_us_standard/$aws/$tarball | |
echo "all done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment