Having automated backups of your database is a very good idea. We’ll set things up so that we can control the backup interval and how many copies of our backups we’ll keep around.

Besides backups, it’s nice to be able to have a stress free way to restore a backup. In the end we’ll have 2 scripts. One for backups and another for restoring.

This video goes over code I’m using on a production server to backup the database of a tool I’m using to help manage my email list. The working example is MySQL but it can be easily modified for PostgreSQL and other databases too. The gist has a PostgreSQL example.

#deployment #linux

Automatic MySQL / PostgreSQL Backups with a Shell Script and Cron Job
1.70 GEEK