Monitor a cron job or backup
Get an alert when a scheduled job stops running.
- Click + New monitor and choose the type Heartbeat.
- Set Expected every to how often the job runs (for example 1 day) and a grace period, how late it may be before it counts as missed.
- Create the monitor and copy its private heartbeat address from the monitor page.
- Make your job call that address when it finishes successfully.
In a crontab, add the call after your command with &&, so it only runs when the job worked:
0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 "https://www.pingturret.com/hb.php?t=YOUR-TOKEN" > /dev/null
In a script:
# bash
curl -fsS -m 10 --retry 3 "https://www.pingturret.com/hb.php?t=YOUR-TOKEN"
# PowerShell
Invoke-WebRequest -UseBasicParsing "https://www.pingturret.com/hb.php?t=YOUR-TOKEN" | Out-Null
# PHP
file_get_contents('https://www.pingturret.com/hb.php?t=YOUR-TOKEN');
If the address ever leaks, click Generate a new URL on the monitor page and update your job.