Add per-camera capture watchdog with stall and recovery notifications

capture-watchdog.sh: long-running script that checks the newest JPEG mtime
in each camera's output directory every CAPTURE_STALE_SECS/3 seconds (min 5s).
Sends a stall notification via notify.sh if no new frame has arrived within
CAPTURE_STALE_SECS. Sends a recovery notification once new frames resume.
Only alerts if the camera was previously working (avoids false positives on
first start or overnight before the first frame of the day).

sky-cam.conf: CAPTURE_STALE_SECS=30 added next to CAPTURE_INTERVAL with a
note that it should be at least 2x the interval.

install.sh: generates sky-cam-watchdog-<cam>.service for every camera that
has a RTSP URL configured. The watchdog service starts after and alongside
the capture service, restarts on failure, and is enabled/started with the
same loop as the capture service.

README.md: note about watchdog and journalctl command for its logs.

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-20 01:13:49 +00:00
parent 8b9ad74c58
commit 3265ed80fd
4 changed files with 92 additions and 0 deletions
+5
View File
@@ -279,6 +279,11 @@ MONTAGE_ATTR_FADE=1 # attribution fade-in and fade-out length (seconds)
# 10 = one frame every 10 s → 8640 frames/day → good timelapse density.
CAPTURE_INTERVAL=10
# Seconds without a new frame before the watchdog sends a stall notification.
# Should be at least 2× CAPTURE_INTERVAL. A recovery notification fires
# automatically when frames start arriving again.
CAPTURE_STALE_SECS=30
# ── Sunrise audio capture ──────────────────────────────────────────────────────
# Records the camera's RTSP audio stream during the sunrise window so that
# daily_sunrise_video.sh can mix in natural ambient sound (birds, rain, wind)