fix: finalize weekly postgres backup retention
All checks were successful
CI / test (pull_request) Successful in 9m11s
CI / deploy (pull_request) Has been skipped

This commit is contained in:
2026-09-15 18:50:22 +03:00
parent 384cd550d5
commit b933f95302
6 changed files with 10 additions and 8 deletions

View File

@@ -2,8 +2,9 @@
set -eu
temporary=$(mktemp)
app_dir=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
trap 'rm -f -- "$temporary"' EXIT HUP INT TERM
crontab -l 2>/dev/null | grep -v 'postgres-backup.sh' > "$temporary" || true
printf '%s\n' '30 3 * * 0 flock -n /tmp/miem-postgres-backup.lock /srv/miem_workers/infra/postgres-backup.sh >/dev/null 2>&1' >> "$temporary"
printf '%s\n' "30 3 * * 0 flock -n /tmp/miem-postgres-backup.lock $app_dir/infra/postgres-backup.sh >/dev/null 2>&1" >> "$temporary"
crontab "$temporary"