From 8d28d1c064a29e94df8d2345a68792374c3c5cf2 Mon Sep 17 00:00:00 2001 From: reachableceo Date: Fri, 4 Sep 2026 16:35:49 -0500 Subject: [PATCH] =?UTF-8?q?feat(sweep):=20backup=20retention=20=E2=80=94?= =?UTF-8?q?=20keep=20newest=202=20automatic=20backups=20[#777]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/daily-sweep.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/daily-sweep.sh b/scripts/daily-sweep.sh index 26bc8a1..e1b44d2 100644 --- a/scripts/daily-sweep.sh +++ b/scripts/daily-sweep.sh @@ -94,6 +94,17 @@ else bad "NUT check on tsys1" fi +# backup retention (#777): HA auto-backups accumulate ~750MB/day on a +# 64GB disk. Keep the newest 2 automatic backups + f93af428 (beta seed) +# + anything from the last 48h; prune older automatic_* tars. +BK=$(VM_IP=pfv-bms-lan.knel.net VM_USER=root VM_PORT=22222 timeout 45 bash tests/remote.sh vm \ + 'cd /mnt/data/supervisor/backup 2>/dev/null && ls -1t automatic_*.tar 2>/dev/null | tail -n +3 | xargs -r rm -f && echo BK-OK' 2>/dev/null | grep -c BK-OK) +if [ "${BK:-0}" -ge 1 ]; then + ok "backup retention applied (newest 2 automatic kept)" +else + bad "backup retention pass on pfv-bms" +fi + # shellcheck disable=SC2016 # remote awk must see literal $5 on the far side DISKCHK=$(VM_IP=pfv-bms-lan.knel.net VM_USER=root VM_PORT=22222 timeout 45 bash tests/remote.sh vm \ 'df -m /mnt/data | awk "NR==2 {if (\$5+0 < 80) print \"DISK-OK\"}"' 2>/dev/null | grep -c DISK-OK)