diet-guard/diet-guard-gate.timer
Krzysztof kuhy Rudnicki 843f5e0221 Extract diet_guard from testsAndMisc as a standalone repo
Rewrites python_pkg.diet_guard imports to diet_guard, vendors the
shared as_float coercion helper, drops the monorepo PYTHONPATH from
install.sh and the systemd unit (package is now pip-installed), and
scaffolds standalone lint/test config matching testsAndMisc's real
enforced bar (pylint --fail-under=10 with tests excluded and the
use-implicit-booleaness/consider-using-with disables, mypy's actual
disabled-error-code set, ruff ALL, bandit, 100% branch coverage).
2026-06-22 12:18:39 +02:00

21 lines
863 B
SYSTEMD

[Unit]
Description=Periodically run the Diet Guard gate check
[Timer]
# Check on a WALL-CLOCK schedule (every 30 min, on the hour and half-hour).
# The 5-hour "log a meal" threshold and the 08:00-22:00 eating window are
# enforced inside gate_is_due(), so the timer only needs to fire often enough to
# notice the boundary; 30 min is plenty.
#
# Why OnCalendar and not OnBootSec/OnUnitActiveSec: the gate is a *blocking*
# oneshot -- it stays up until a meal is logged -- and a monotonic schedule
# computed no next elapse once the service had run (and none at all across a
# reboot), leaving the timer dormant (NextElapse=infinity). OnCalendar re-arms
# every period regardless of how long the gate stayed open, and Persistent
# catches a run missed while the machine was suspended.
OnCalendar=*-*-* *:00/30:00
Persistent=true
[Install]
WantedBy=timers.target