# IRDB scheduler tick — systemd service
#
# Install:
#     sudo cp examples/scheduler/irdb-tick.{service,timer} /etc/systemd/system/
#     sudo systemctl daemon-reload
#     sudo systemctl enable --now irdb-tick.timer
#
# Set INTERNAL_JOB_TOKEN in /etc/default/irdb (or whichever
# EnvironmentFile your distro convention uses).

[Unit]
Description=IRDB scheduler tick — invoke any due periodic job
After=docker.service

[Service]
Type=oneshot
EnvironmentFile=/etc/default/irdb
# -m 280 caps the request at just under the timer's once-per-minute
# cadence so we never queue overlapping ticks.
ExecStart=/usr/bin/curl -sf -m 280 -X POST \
    -H "Authorization: Bearer ${INTERNAL_JOB_TOKEN}" \
    http://localhost:8081/internal/jobs/tick

# This is a poll, not state-changing; failure is non-fatal — the next
# minute's tick will retry.
SuccessExitStatus=0 22 28
