fix(reliability): watchdog max lifetime + serialized gate entry (review fixes)

This commit is contained in:
2026-08-22 14:08:25 -06:00
parent a008bb9167
commit 78aab64af0
2 changed files with 21 additions and 10 deletions
@@ -1,9 +1,10 @@
#!/bin/sh
# Usage: mk8-watchdog.sh <profile> <interval> <fail_after> <healthy_after>
PROFILE="$1"; IV="${2:-5}"; FA="${3:-6}"; HA="${4:-6}"
# Usage: mk8-watchdog.sh <profile> <interval> <fail_after> <healthy_after> [max_ticks]
# Exits quietly after max_ticks healthy ticks so sentinels cannot accumulate.
PROFILE="$1"; IV="${2:-5}"; FA="${3:-6}"; HA="${4:-6}"; MT="${5:-120}"
DIR="/root/payloads/user/remote_access/pager-webui"
[ -f "$DIR/server.py" ] || DIR="/mmc/mk8/releases/current"
fails=0; oks=0; tripped=0
fails=0; oks=0; tripped=0; ticks=0
probe() {
curl -fsS -m 3 http://127.0.0.1:8080/ >/dev/null 2>&1 &&
{ ip link show wlan0mon >/dev/null 2>&1 ||
@@ -12,6 +13,10 @@ probe() {
while true; do
if probe; then
fails=0
ticks=$((ticks + 1))
if [ "$tripped" = "0" ] && [ "$ticks" -ge "$MT" ]; then
exit 0
fi
if [ "$tripped" = "1" ]; then
oks=$((oks + 1))
if [ "$oks" -ge "$HA" ]; then