Postgres – Automate DB Backups

Automate DB Backups for your Postgres DB. This can be implemented by storing the DB Account password in a .pgpass file under the user’s home directory. The contents of the file look like:


Once the pgpass file is setup – backups is just as simple as

pg_dump -h localhost -U otheruser -w other_db > other_db_backup.sql

-w indicates that the password prompt is not required. The system will look for the password in the user’s pgpass file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s