Created
April 20, 2012 22:42
-
-
Save petedoyle/2432419 to your computer and use it in GitHub Desktop.
Backup postgres, upload to s3 using s3cmd
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 | |
if [ -z "$1" ] | |
then | |
FILENAME=pg_dumpall_$(date +"%Y%m%d-%H:%M:%S").sql.gz | |
else | |
FILENAME=$1 | |
fi | |
FQ_FILENAME=/var/lib/pgsql/backups/$FILENAME | |
su -c "pg_dumpall | gzip -c > $FQ_FILENAME" postgres | |
s3cmd --config=/root/config/servers/db1/scripts/s3cfg --acl-private --encrypt put $FQ_FILENAME s3://my.bucket.com/postgres/$FILENAME.gpg | |
rm -f $FQ_FILENAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment