Home > Support > HOWTO List > Postgres

Postgresql

Postgres is a popular open source database.

Postgresql backups

The following file will backup a given database to /var/log/.  It will create a different file for each day of the week - the %u option in the date command.  After that it will overwrite files.



cat /etc/cron.d/backupfsn.sh
#!/bin/bash
backup_dir="/var/log/"
timeslot=`date +%u`
i=dbnametobackup
/usr/bin/pg_dump -U postgres $i | gzip > "$backup_dir/postgresql-$i-$timeslot-database.gz"

Getting a list of databases


psql  -U postgres -q -c "\l" dbname | sed -n 4,/\eof/p | grep -v rows\) | awk {'print $1'}

Hosting

Why RimuHosting

RimuHosting