pgsql: pgdump authentication

I'm trying to do a backup similar to mysqldump... but it seems that pgsql (very intelligently though) does not allow you to pass pasword on via text on the script. So the solution to be able to execute this command is create a file called ".pgpass" in the folder of the user that will execute the command. For Ex. if root will run this create a file in /root/.pgpass

Inside the file you'll put the credentials to the database, so when you execute pg_dump it will look for the credentials on this file and will not request a password, which will then allow you to run this as a CRON.

The format of the command is:

pg_dump -U $USER -Fc $DATABASE > /home/Scripts/idempiere.sql






Leave a Reply

Your email address will not be published. Required fields are marked *