I was putting together a quick cron job today to dump a postgresql database, using pg_dump.
If you need to connect to the database with a password (because local trust is turned off), then you need a way to pass the password into pg_dump. pg_dump does not allow a command line password specification (for good reason... you don't necessary want the password showing up in a process listing by someone else on the box).
But it appears that pg_dump will look for an environment variable named PGPASSWORD.
In your script:
export PGPASSWORD=somereallysupersecurepassword
pgdump databasename
voila!
Wednesday, March 25, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment