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:
+20
@@ -137,6 +137,26 @@ WantedBy=default.target
|
||||
EOF
|
||||
echo " wrote sky-cam-capture-${cam}.service"
|
||||
capture_services+=("sky-cam-capture-${cam}")
|
||||
|
||||
cat > "$UNIT_DIR/sky-cam-watchdog-${cam}.service" <<EOF
|
||||
[Unit]
|
||||
Description=Sky-Cam — ${cam}: capture watchdog (stall detection)
|
||||
After=sky-cam-capture-${cam}.service
|
||||
Wants=sky-cam-capture-${cam}.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=$SCRIPT_DIR/capture-watchdog.sh ${cam}
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
echo " wrote sky-cam-watchdog-${cam}.service"
|
||||
capture_services+=("sky-cam-watchdog-${cam}")
|
||||
else
|
||||
echo " WARNING: CAM_RTSP_${cam} not set — skipping capture service for ${cam}"
|
||||
echo " (set CAM_RTSP_${cam}=rtsp://... in sky-cam.conf to enable)"
|
||||
|
||||
Reference in New Issue
Block a user