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)