Jump to: navigation, search

This hot script is executed via postgresql cron nightly.

30 00 * * * /var/lib/postgresql/scripts/ >> /var/log/postgresql/hotbackup.log 2>&1

The below script sends the backup file to two locations. Locally to /backups directory and to the standby server (see rsyncd.conf configuration for receiving end setup). Pay close attention to the /var/tmp directory. Temporary files get created in there, so during backup time this can grow close to your backup file size.

The last two lines simply delete the files that go off of our on-disk retention period. I'd love have something that actually follows the WAL file naming convention to make sure that the right WAL files get preserved. This is quick and easy and works well enough.


/usr/local/bin/omnipitr-backup-master -D /postgres/db/9.0/main -l /var/log/postgresql/omnipitr.log /
-x /var/tmp/omnipitr/dstbackup -dr /backups -dr rsync:// /
-t /backups/omnipitr/ --pid-file /tmp/ -v 

find /postgres/WAL -mtime +4 ! -iname "lost+found" -exec rm {} \;
find /backups -maxdepth 1 -type f -mtime +4 ! -iname "lost+found" -exec rm {} \;