Closed booo closed 8 years ago
Current backup script:
#!/bin/bash
DATABASES="wizard nipap ca"
BACKUP_DIR=/root/postgres-backups
DATE=$(date +"%Y%m%d")
USER=postgres
for database in $DATABASES; do
path="${BACKUP_DIR}/$database-${DATE}.sql"
su -l -c "pg_dump ${database}" $USER > $path
done
# remove all backups older then one week
/usr/bin/find ${BACKUP_DIR} -mtime +7 -name "*.sql" -print -exec /bin/rm {} \;
#TODO backup on another machine
Should be done.
At the moment we create database "backups" with the script in
/etc/cron.daily/postgres-backup
. Functionality that removes old backups is missing which is a problem.