-
-
Save skplunkerin/c39fd0f50bcc4b8344d85a7d6e3d80f0 to your computer and use it in GitHub Desktop.
Wylies mysql s3 backup daily backup cron solution
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 | |
NOWDATE=`date +%Y-%m-%d` | |
BACKUPNAME="$NOWDATE.sql.gz" | |
echo "Creating backup of database finances to $BACKUPNAME" | |
mysqldump --user=[username] --password=[password] [database] | gzip -9 > $BACKUPNAME | |
echo "Succesfully created database backup" | |
echo "Uploading backup to Amazon S3 bucket…" | |
s3cmd put $BACKUPNAME s3://[path-to-bucket-and-folder]/$BACKUPNAME | |
echo "Successfully uploaded backup to S3" | |
echo "Deleting backup file…" | |
rm $BACKUPNAME | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment