diff --git a/scripts/ops-health.sh b/scripts/ops-health.sh index 5cee3d2..42daf66 100755 --- a/scripts/ops-health.sh +++ b/scripts/ops-health.sh @@ -62,6 +62,11 @@ human_age() { else echo "$((s / 86400))d"; fi } +# Age of a file in seconds, or empty when it doesn't exist. +file_age() { + [ -f "$1" ] && echo $(( $(date +%s) - $(cat "$1" 2>/dev/null || echo 0) )) || echo "" +} + cd "$REPO" 2>/dev/null || { echo "ops-health: repo not found: $REPO" >&2; exit 2; } now=$(date +%s) @@ -153,8 +158,13 @@ else p " ${DIM}→ reason: ${sk_reason}${N}" ;; esac else - p " ${Y}no skip reason recorded — the deploy timer may not be running.${N}" - problems+=("deploy pending with no recorded reason"); signature+="noreason;" + r_age="$(file_age "$RUN_FILE")" + if [ -n "$r_age" ] && [ "$r_age" -lt 360 ]; then + p " ${DIM}waiting for the next deploy tick (~every 3m)…${N}" + else + p " ${Y}no skip reason recorded and the deploy script hasn't run recently — the timer may be stopped.${N}" + problems+=("deploy pending with no recorded reason"); signature+="noreason;" + fi fi fi