feat(sweep): backup retention — keep newest 2 automatic backups [#777]

This commit is contained in:
2026-09-04 16:35:49 -05:00
parent 18c590ba2a
commit 8d28d1c064
+11
View File
@@ -94,6 +94,17 @@ else
bad "NUT check on tsys1" bad "NUT check on tsys1"
fi 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 # 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 \ 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) 'df -m /mnt/data | awk "NR==2 {if (\$5+0 < 80) print \"DISK-OK\"}"' 2>/dev/null | grep -c DISK-OK)