Skip to content
HookPulse

Monitor systemd timer jobs with HookPulse check-ins

ExecStopPost sends the exit status of each run to HookPulse, also when the service fails.

Updated

1Create the monitor

Add a routine named nightly-backup and set how often the job runs. Its page shows the check-in URL: use it in place of https://hookpulse.net/in/YOUR_ID.

2Add ExecStopPost to the service

systemd runs ExecStopPost after every run and sets EXIT_STATUS: 0 is a success.

# /etc/systemd/system/backup.service
[Unit]
Description=Nightly backup

[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup.sh
ExecStopPost=/bin/sh -c 'curl -fsS -m 10 --retry 3 "https://hookpulse.net/in/YOUR_ID/$EXIT_STATUS"'

3Schedule it with a timer

Then run systemctl daemon-reload and systemctl enable --now backup.timer.

# /etc/systemd/system/backup.timer
[Unit]
Description=Run the nightly backup

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true

[Install]
WantedBy=timers.target

4Run it once

Run systemctl start backup.service. The routine shows the first check-in. From then on, a missed or failed run sends the alert.