Created
May 28, 2013 12:31
-
-
Save powellc/5662427 to your computer and use it in GitHub Desktop.
Shell script to use duplicity and AWS S3 to backup files on a server, hooray. Not the most secure way to handle your password and AWS key, but couldn't get easier, giving you no reason to have some kind of backup of your server.
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 PASSPHRASE=your_gpg_passphrase | |
export AWS_ACCESS_KEY_ID=your_s3_access_key | |
export AWS_SECRET_ACCESS_KEY=your_s3_secret | |
export MYSQL_PASSWORD=your_mysql_password | |
for DB in app_1 app_2 app_3; do | |
mysqldump -h localhost -u backup_user -p${MYSQL_PASSWORD} ${DB} | gzip > /var/dbdumps/${DB}.sql | |
done | |
duplicity --include /var/www --include --include /var/dbdumps --exclude "**" --full-if-older-than 30D / s3+http://com.mycorp.myhost.backup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment