mediapi/systemd
Jean-Michel Tremblay 9d52e46d1e Add mediapi-watchdog: reboot the Pi if the mpv player wedges
On 2026-07-09 a kernel keyring-GC oops left the player stuck in
uninterruptible D-state while systemd, SSH, and the Flask app stayed
alive -- so the box sat dead all night instead of recovering. A plain
systemd/hardware watchdog only fires on a TOTAL hang and would not have
caught that partial wedge.

mediapi-watchdog.service (Type=simple, Restart=always, runs as root)
pings mpv over its JSON IPC socket every 30s; after ~3 min of continuous
failure it forces a reboot (systemctl reboot -ff, then SysRq as a
kernel-level fallback that works even when userspace is wedged). A
D-state mpv accepts the socket connect but never replies, so the ping
times out and is caught. install.sh installs + enables it.

Verified: no false positives while mpv is healthy; correctly detects a
stopped mpv and reaches the reboot decision (tested in dry-run).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:03:45 -04:00
..
mediapi-app.service.template Replace Kodi with mpv as the player; drive it over its JSON IPC socket 2026-07-09 18:16:20 -04:00
mediapi-mpv.service.template Fix mpv never starting: drop the PAMName=login hang, tear down old Kodi 2026-07-09 19:04:45 -04:00
mediapi-watchdog.service.template Add mediapi-watchdog: reboot the Pi if the mpv player wedges 2026-07-09 20:03:45 -04:00