pq_dump command does not accept any password as argument. Here I am adding a small script which will
help you to take backup of your postgres database
#!/bin/bash
TODAY=`date +%b%d%Y`
DST=/path/to/put/backup
export PGPASSWORD=password #Adding postgres password in script
find $DST/* -maxdepth 0 -type f -mtime +40 -exec rm -v '{}' \;
pg_dump -U dbuser -h localhost dbname | bzip2 -c > $DST/pg.db.$TODAY.bz2
Thank you very much..It working fine.. great jobs ..
ReplyDelete