Created
January 9, 2016 09:53
-
-
Save solusipse/9975886d1900ecb4f7b8 to your computer and use it in GitHub Desktop.
postgresql backup
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 | |
# remember to set local to trust in pg_hba.conf | |
sudo -u postgres pg_dumpall | gzip -c > /backup/db.sql | |
RESULT=$? | |
if [ $RESULT -ne 0 ]; then | |
echo "Database backup failed at domain.com!" | mail -s "Backup error" your@address.com | |
fi | |
chmod 0600 /backup/db.sql | |
date > /backup/last.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment