Files
buryan-infra/ops/audit/audit360_backup.sh
T
architect 768ba209f6
lint / hygiene (push) Failing after 19s
lint / hygiene (pull_request) Failing after 23s
standard / check (push) Successful in 10s
standard / check (pull_request) Successful in 10s
[ARCH] Audit 360 service, collectors, snapshots and sprint tool
2026-11-26 21:45:23 +03:00

12 lines
453 B
Bash
Executable File

#!/bin/bash
set -e
DEST=/mnt/archive/backups/audit
mkdir -p "$DEST"
STAMP=$(date +%Y%m%d-%H%M)
export PGPASSWORD=$(cat /root/.pg-superuser-pass)
pg_dump -h 192.168.1.151 -U postgres -d rag -n audit -Fc -f "$DEST/audit-$STAMP.dump"
curl -fsS --max-time 30 http://127.0.0.1:9160/api/export -o "$DEST/audit-$STAMP.json"
gzip -f "$DEST/audit-$STAMP.json"
find "$DEST" -type f -mtime +30 -delete
ls -lh "$DEST/audit-$STAMP.dump" "$DEST/audit-$STAMP.json.gz"