I have to do a dump of a Postgres database on a regular basis.
So pg_dump
is the obvious choice to do this as is cron
to do this periodically.
But the main problem with this is – pg_dump
expects a password to be entered at the prompt. There’s no way to pass the password in the prompt to be able to do this.
Stackoverflow to the rescue.
What is required is a .pgpass
file in the home
directory.