Files
2021-04-07 09:06:16 +02:00

15 lines
299 B
Bash
Executable File

#!/bin/bash
umask 027
cd /tmp
# set environment
BACKUP_DIR=/backup/pg-backup/
HOLD_DAYS=3
cur_date=$(/bin/date +"%Y-%m-%d")
# full dump postgres dbs
/usr/bin/pg_dumpall | /bin/gzip > $BACKUP_DIR/$cur_date.sql.gz
# cleanup
find $BACKUP_DIR -maxdepth 1 -type f -ctime +$HOLD_DAYS -exec rm -rf {} +