Files
buryan-infra/ops/audit/service_backups.sh
T
architect 0225cfb9d4
lint / hygiene (push) Failing after 19s
lint / hygiene (pull_request) Failing after 20s
standard / check (push) Successful in 13s
standard / check (pull_request) Successful in 11s
[ARCH] Daily Prism/Seerr backups with restore evidence
2026-11-26 23:34:50 +03:00

12 lines
772 B
Bash
Executable File

#!/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"