PostgreSQL Backup Script
#!/bin/sh
DB_NAME=mydatabase
DATE=`date +%Y%m%d%H%M%S`
DIR=/backups/pgsql
PG_DUMP=/usr/bin/pg_dump
$PG_DUMP $DB_NAME | bzip2 > $DIR/$DB_NAME_$DATE.sql.bz2
find $DIR -mtime +7 -exec rm {} \;
March 28, 2021
#!/bin/sh
DB_NAME=mydatabase
DATE=`date +%Y%m%d%H%M%S`
DIR=/backups/pgsql
PG_DUMP=/usr/bin/pg_dump
$PG_DUMP $DB_NAME | bzip2 > $DIR/$DB_NAME_$DATE.sql.bz2
find $DIR -mtime +7 -exec rm {} \;
Author, software maker, RC airplane enthusiast, player of strung instruments, bibliophile.