Add misc scripts to repoitory
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
BACKUP_DIR="/var/lib/postgresql_archive/pgbackups/$(date +%Y%m%d)"
|
||||
mkdir -p $BACKUP_DIR
|
||||
# Perform base backup with WAL streaming
|
||||
pg_basebackup -h localhost -U wjones -D $BACKUP_DIR -Fp -Xs -P
|
||||
# Optional: Compress
|
||||
tar -czf ${BACKUP_DIR}_$(date +%Y%m%d_%H%M%S).tar.gz $BACKUP_DIR
|
||||
rm -rf $BACKUP_DIR
|
||||
# Retention: Delete backups older than 7 days
|
||||
find /var/lib/postgresql_archive/pgbackups/ -type f -mtime +7 -name "*.tar.gz" -delete
|
||||
Reference in New Issue
Block a user