Cron Heartbeat URL Generator

Build the crontab line that pings your heartbeat URL each time a job succeeds, and reports a failure straight away when it doesn't. You also get the period and grace time to set on the heartbeat monitor, and a wrapper script to download.

Made for Edesy OnCall heartbeat monitors, which phone you when a ping is late. Full reference: heartbeat monitors.

Your job

Copy it from your heartbeat monitor's page in Edesy OnCall. Left empty, the lines use a placeholder you can replace later. Keep the real URL private.

The ping is sent when the job finishes, so the grace period has to cover a slow run.

When the command fails, call the URL with status=fail so you are phoned at once instead of when the ping is late.

Shown in the incident. Avoid the % sign: cron treats it as a new line.

Replace YOUR_TOKEN with the token from your OnCall heartbeat monitor before you save the crontab.

Your crontab line

Paste into crontab -e
0 2 * * * if /usr/local/bin/backup.sh; then curl -fsS -m 10 --retry 3 https://oncall.edesy.in/hb/YOUR_TOKEN > /dev/null; else curl -fsS -m 10 -G --data-urlencode status=fail --data-urlencode "msg=job failed" https://oncall.edesy.in/hb/YOUR_TOKEN > /dev/null; fi

Set the heartbeat monitor in OnCall to

  • Expect a ping every:24 hours
  • Grace period:8 minutes
  • Plans that allow this period:Free, Starter or Pro

Or wrap the job in a script

heartbeat-wrapper.sh
#!/bin/sh if /usr/local/bin/backup.sh; then curl -fsS -m 10 --retry 3 https://oncall.edesy.in/hb/YOUR_TOKEN > /dev/null else curl -fsS -m 10 -G --data-urlencode status=fail --data-urlencode "msg=job failed" https://oncall.edesy.in/hb/YOUR_TOKEN > /dev/null fi

-f makes curl fail on HTTP errors, -m 10 stops it hanging, and --retry 3 rides out a brief network blip. The failure ping uses --data-urlencode, so the message needs no escaping and the line has no % sign.

Get a phone call when a job doesn't run (free for 3 monitors)

How to use it

Step 1

Create a heartbeat monitor

In Edesy OnCall, add a Heartbeat monitor and copy its URL.

Step 2

Describe the job

Pick how often it runs, its longest run time and the command.

Step 3

Paste the line

Run crontab -e and paste the line, or download the wrapper script.

Step 4

Set period and grace

Use the suggested period and grace on the monitor so slow runs don't call you.

Cron heartbeat FAQ

What is a cron heartbeat URL?

A secret URL your job calls every time it runs. A heartbeat monitor watches for the call and raises an alert when it doesn't arrive within the expected period plus a grace time. It catches jobs that never started, crashed or hung, which an uptime check can't see.

Why ping only after the job succeeds?

Because a ping at the start says the job began, not that it worked. Chaining the ping with && (or putting it in the success branch) means a failed job sends no ping, and the monitor alerts you.

Why not put the message in the URL as msg=backup%20failed?

Cron treats an unescaped % in a crontab line as a new line, which breaks the command. The generated line uses curl -G --data-urlencode, so curl adds the encoding at run time and the crontab line stays free of % signs.

How do I choose the grace period?

The ping arrives when the job finishes, so the grace has to cover the job's longest run plus a margin. The tool suggests one and a half times the longest run time, with a minimum of 2 minutes.

Can I monitor a weekly job?

Not with an Edesy OnCall heartbeat today. The longest expected period is 24 hours, with up to 24 hours of grace. Jobs that run at least once a day are fine.

Is the heartbeat URL sent anywhere by this tool?

No. The lines are built in your browser. Nothing you type is sent to Edesy until your job calls the URL itself.

Features

  • Crontab line with success ping and optional failure ping

  • Presets from every minute to once a day, or your own cron expression

  • Suggested heartbeat period and grace time

  • Failure message URL-encoded by curl, no % in crontab

  • Wrapper script download

  • Runs in your browser, no signup

Who it's for

Backups

Know the same night when a database dump or file backup didn't run.

Reports and exports

Daily reports, feed exports and billing runs that fail without anyone noticing.

Sync jobs and workers

Inventory, price and order syncs, or queue workers that ping after each batch.

Start monitoring your cron jobs

The Free plan includes 3 monitors. Alert calls are billed per minute from your Edesy wallet; prices exclude 18% GST.

Start free: 3 monitors