KhodeN
1/28/2016 - 9:37 AM

dump psql by cron

dump psql by cron

#!/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