health-check.sh: only check last 60 seconds of autossh logs for tunnel failures to avoid false positives from old log entries

This commit is contained in:
Justin Oros
2026-04-22 08:52:15 -07:00
parent defb4fdaa3
commit 518f54394c

View File

@@ -121,7 +121,7 @@ check_spoke() {
ok "autossh container running ($autossh_container)"
local logs
logs=$(docker logs "$autossh_container" 2>&1 | tail -20 || true)
logs=$(docker logs "$autossh_container" --since 60s 2>&1 || true)
if echo "$logs" | grep -q "remote port forwarding failed"; then
fail "Tunnel reports port forwarding failed — check hub authorized_keys"
else
@@ -206,7 +206,7 @@ check_hub() {
fail "rclone remote [${spoke_name}-remote] not found in rclone.conf"
fi
if crontab -u "$(basename "$HUB_HOME")" -l 2>/dev/null | grep -q "${spoke_name}-remote:"; then
if crontab -u "$(basename "$HUB_HOME")" -l 2>/dev/null | grep -qE "${spoke_name}-remote:|mount-${spoke_name}"; then
ok "Auto-mount crontab entry present"
else
warn "No auto-mount crontab entry for $spoke_name"