Have a technical problem or question, call on the Computer Plumbers!

Are you frustrated and feel like flushing your computer? No matter what the situation, the Computer Plumber can help!!

Simple Postgresql Cron Backup

Here is a very simple method to backup your postgresql DB using a cron job and the pg_dump command. The main problem people encounter when trying to automate the pg_dump command is the password input. Now you could easily create a local user with no password, but why would you want to do that.

The first thing you will want to do is login as the postgresql user that was created during setup, you want to do this to circumvent the interactive password of pg_dump. You will do the rest of the instructions as this user.

su postgres

Now the process is rather straightforward from here. I like to make a bash script, then run that daily with cron. The script I like usually looks something like this: