Created
January 28, 2016 09:37
-
-
Save KhodeN/26cd4c967bf6cfb5f17b to your computer and use it in GitHub Desktop.
dump psql by cron
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 | |
now=$(date +"%Y-%m-%d_%H:%M") | |
cd /projects/datamarket | |
pg_dump -U postgres dm | gzip > backups/dm_dump_$now.sql.gz | |
# use this row to backup every hour | |
# crontab -e | |
# * */1 * * * /projects/datamarket/dump.sh | |
# set password for ~/.pgpass (chmod 600) | |
# localhost:5432:*:postgres:myPassword |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment