Running but dead: a 2-minute TCP watchdog for services restart policies can't save
petrusenko_max · x · 2026-12-06
launchd KeepAlive, systemd Restart=, and Docker restart policies only ask "did the process exit?" — a service that stays up but stops answering gets no rescue. The author's X reply bot was down 2 days after the hermes gateway on his Mac mini hung post-update; a stale process holding a port had caused a similar outage. His fix: a shell watchdog on a 2-minute timer that opens a real TCP connection (nc -z, 5s timeout) with rules: two consecutive failures before restart; kill leftover 30-min+ stale processes first; cap 3 restarts/hour to avoid loops; re-bootstrap unloaded jobs; skip when the machine's Tailscale address is absent; log one line, no notifications. Logs show 21-second recovery. Caveat: TCP connect only proves something accepts connections — probe a health endpoint and read the response body if you have one.
More from coding & agent
- Team bets on iLands agent economy with stakes to counter closed-loop collapse — profjamesevans · 2026-12-06
- 20 Useful Hermes Plugins Across Work, Life, Creative, and Money, Curated From ~3,000 — alexcovo_eth · 2026-12-06
- Perplexity Teammates: 1M+ automations in first month, already 20% of credit revenue — inductionheads · 2026-12-06
- I built 60+ business automations. 38 of 63 survived — here's what the winners did differently — Beautiful-Radish-624 · 2026-12-06
- Dev still hand-writes 0.1-1% of code to keep a 'human touch' in the AI era — rachittshah · 2026-12-06
- Microsoft details four architectures for wiring Copilot Studio agents to Fabric data — adnan_hashmi · 2026-12-06