PostgreSQL backup
9:37 AM
PostgreSQL backup script, good for both standalone and cluster setup.
#!/bin/bash backuppath= "/data/postgresql/pgsql_backups" now=$(date + "%Y-%m-%d" ) if [ -n "$(pgrep postgres)" ] then find $backuppath/* -mtime + 2 -exec rm -f {} \; su - postgres -c "pg_dumpall | gzip -f > $backuppath/pgbackup-$now.sql.gz" fi |
Postgres Backup Setup
Steps for Redhat servers with Postgres database.
- vi <backup Path>/BackupScript.sh
- copy and paste the attached file called fulldatabasebackup for a full database backup only
- chmod 755 <backup Path>/BackupScript.sh
- cp <backup Path>/BackupScript.sh /etc/cron.daily/BackupScript.sh
0 comments