Created
May 3, 2013 19:08
-
-
Save daum/5512948 to your computer and use it in GitHub Desktop.
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 | |
SQL_FILE="$(date +%m-%d-%y).sql" | |
mysqldump -ubackupuser -p'backupuser-password' --all-databases > "$SQL_FILE" | |
RC = $? | |
if [[ $RC != 0 ]] ; then | |
echo "Failure, mysqldump failed to dump" | |
exit $RC; | |
fi | |
gzip "$SQL_FILE" | |
RC = $? | |
if [[ $RC != 0 ]] ; then | |
echo "Failure, gzip failed to zip!" | |
exit $RC; | |
fi | |
s3cmd put $SQL_FILE.gz s3://mybackup-db/$SQL_FILE.gz | |
RC = $? | |
if [[ $RC != 0 ]] ; then | |
echo "Failure, s3cmd failed to put file in bucket" | |
exit $RC; | |
fi | |
rm $SQL_FILE.gz | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment