Add misc scripts to repoitory

This commit is contained in:
2026-04-23 08:26:38 -04:00
parent b82c9af8c4
commit 1ebf3f1435
13 changed files with 1617 additions and 9 deletions
+10
View File
@@ -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