ArticlesUptime

Heartbeats: know when a scheduled job silently stops

A backup or cron job can stop running without any error. A heartbeat monitor waits for a ping from the job and alerts you when the ping doesn't arrive.

Some jobs fail by not running. Last night's backup, the export to your accounting system, the cron job that cleans up old orders. Nothing goes down and nothing sends an error. A heartbeat monitor turns that silence into an alert.

How a heartbeat works

Most monitors go out and check something. A heartbeat works the other way round: it waits for your job to check in.

  1. Add a heartbeat monitor in the app. You get a ping address at hb.monitoruptime.eu, unique to that monitor.
  2. Call the address at the end of your job. One line in the script or the scheduler.
  3. If the ping is late, you hear about it. By e-mail on every plan, and in Slack, Teams or by webhook on Pro and Business.

Add the ping to your job

On Linux, add the call to the cron line, after the job:

cronNightly backup at 03:00
0 3 * * *  /opt/backup.sh && curl -fsS https://hb.monitoruptime.eu/p/<your-token>

On Windows, in a PowerShell script run by Task Scheduler, put this as the last line:

PowerShellLast line of the script
Invoke-WebRequest -UseBasicParsing https://hb.monitoruptime.eu/p/<your-token>

The app gives you the exact address for each heartbeat.

Ping only when the job succeedsThe && in the cron line sends the ping only if the backup script finished without an error. A failed backup then shows up as a missing ping. A job can also report a failure straight away by calling the same address with /fail at the end.
Keep the address privateAnyone with the ping address can send a ping. Keep it in the job's settings, out of public code.

What to watch with a heartbeat

  • Backups of your website, database or file server
  • Exports and syncs: orders to the accounting system, stock from a supplier
  • Cleanup jobs that keep a disk from filling up
  • Certificate renewal jobs, next to SSL Monitor
  • Any script you'd only miss once it had stopped for a week

How many you get

PlanHeartbeats
Uptime Pro, €12Count within your 50 monitors
Uptime Business, €39Count within your 250 monitors
Personal, free1 heartbeat, next to 5 monitors

Prices are per month, excluding VAT. The free plan is for personal and hobby use.

Related

All Uptime articles · Uptime blog

Be the first to know, and the one with the answer

Uptime Pro, €12 a month: checks every minute, 3 status pages. Monthly, cancel any time.Personal or hobby site? Monitor it free.