diff --git a/ops/audit/service_backups.sh b/ops/audit/service_backups.sh new file mode 100755 index 0000000..00b251f --- /dev/null +++ b/ops/audit/service_backups.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +STAMP=$(date +%Y%m%d-%H%M) +mkdir -p /mnt/archive/backups/prism /mnt/archive/backups/seerr +export PGPASSWORD=$(cat /root/.pg-superuser-pass) +pg_dump -h 192.168.1.151 -U postgres -d rag -n prism -Fc -f "/mnt/archive/backups/prism/prism-$STAMP.dump" +pct exec 121 -- sh -lc "tar --warning=no-file-changed -czf /tmp/seerr-config-$STAMP.tar.gz -C /opt/seerr/config ." >/tmp/seerr_tar.log 2>&1 +pct pull 121 "/tmp/seerr-config-$STAMP.tar.gz" "/mnt/archive/backups/seerr/seerr-config-$STAMP.tar.gz" >/dev/null +pct exec 121 -- rm -f "/tmp/seerr-config-$STAMP.tar.gz" +find /mnt/archive/backups/prism /mnt/archive/backups/seerr -type f -mtime +30 -delete +ls -lh "/mnt/archive/backups/prism/prism-$STAMP.dump" "/mnt/archive/backups/seerr/seerr-config-$STAMP.tar.gz"