Blog Archive for April 22, 2018

Backup up Postgres Databases

April 22, 2018

I wanted to dump the contents of some postgres databases into files, complete with a date timestamp. I also wanted to gzip the files to save disk space.

This can be done with the following in the postgres user crontab file:

0 4 *** pg_dump databasename | gzip > /home/drumcoder/db/database-`date …