Order a VPS, Semi- dedicated or Dedicated server in Dallas, London or Australia.
Ask our support team about your hosting requirements.
Host where the staff takes pride in making customers happy
You guys rock, as usual!
- Neil (after an additional server order) (#105/289)
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'}

