DataDad.

Cron job monitors (heartbeats)

Get an alert when a backup, a cron job or any scheduled task stops running. Your job calls a private URL each time it finishes.

Updated

A cron job monitor waits for your job to report in. If no report arrives on time, the monitor goes down and your contacts get an alert. This works for backups, imports, reports and any task that runs on a schedule.

Add a cron job monitor

  1. Open Uptime and select Add monitor.
  2. Select Scheduled job, then Continue.
  3. Enter a name, such as Nightly backup.
  4. Under Runs every, choose how often the job runs.
  5. Under Grace time, choose how late the job may be before you get an alert. If the project has no website yet, also enter your website. The job is listed under it.
  6. Select Continue, then choose who gets alerts.
  7. The summary shows the private ping URL. Select Copy, and add the URL to your job. The summary shows when the first call arrives.

Call the ping URL from your job

Add one request to the end of your job. Only call the URL when the job succeeds.

0 3 * * * /path/to/backup.sh && curl -fsS -m 10 --retry 3 https://data.dad/ping/YOUR-ID/YOUR-TOKEN > /dev/null
#!/bin/sh
set -e
/path/to/backup.sh
curl -fsS -m 10 --retry 3 https://data.dad/ping/YOUR-ID/YOUR-TOKEN > /dev/null
& C:\jobs\backup.ps1
if ($?) { Invoke-RestMethod -Uri "https://data.dad/ping/YOUR-ID/YOUR-TOKEN" -TimeoutSec 10 }
import urllib.request
run_backup()
urllib.request.urlopen("https://data.dad/ping/YOUR-ID/YOUR-TOKEN", timeout=10)

Use the URL from your monitor page instead of YOUR-ID/YOUR-TOKEN. The URL works with GET, HEAD and POST and needs no sign-in.

Report a failure at once

When your job knows it failed, add /fail to the URL. The monitor goes down at once and does not wait for the grace time.

/path/to/backup.sh || curl -fsS -m 10 https://data.dad/ping/YOUR-ID/YOUR-TOKEN/fail

When the monitor goes down