Cron job monitoring that rings your phone
A cron job that stops running doesn't send an error. It just stops, and you find out the day you need the backup. Tissue Mast turns that silence into a page: the job checks in when it finishes, and a missed check-in is the alert.
Make a heartbeat, say how often the job runs, and put one curl on the end of the crontab line:
17 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://mast.tissue.dev/mk_8e2a… >/dev/null
If that beat hasn't arrived by 03:17 plus the grace you allowed, Mast pages you, and the page keeps ringing until somebody acknowledges it. Free covers ten heartbeats with an email address and no credit card.
What heartbeat monitoring is
Most monitoring looks at something from outside and asks whether it answers. A cron job has nothing to answer with. It runs for four minutes at three in the morning and then it isn't there. So the check goes the other way: the job calls a URL when it's done, and Mast watches the clock for that call.
People call this heartbeat monitoring or cron monitoring, and sometimes a dead man's switch, because the alarm goes off when the signal stops. In Mast it's a heartbeat, and each call to it is a beat. One missing beat covers every way a job can die without saying so: a script that errors out before the curl, a cron daemon that stopped, a server that's powered off, a container that never got scheduled, a disk that filled up.
What happens when a job is late
Each heartbeat has a period, or a crontab schedule, and some grace.
| State | When | What happens |
|---|---|---|
| Waiting | From creation until the first beat | Nothing is counted, so a heartbeat you make on Friday and wire up on Monday pages nobody over the weekend. |
| On time | A beat arrived within the period | Nothing. |
| Late | The period has passed with no beat | It shows as late. Nobody is woken. |
| Down | The period and the grace have both passed | A page at the priority you chose for the heartbeat, and heartbeat_down to any webhooks. |
| Back up | The next beat arrives | The page closes on its own and the card says how long the silence lasted. |
A job on a fixed time wants a schedule rather than a period. Give the heartbeat the crontab line itself, 17 3 * * * (the cron expression explainer reads one back in plain words), with a time zone such as America/Los_Angeles, and it's judged against the last time the job should have fired. A weekly job stays quiet for six days on purpose. When it goes down, the card names what it was waiting for, along the lines of No beat for 20 min; expected 03:17 America/Los_Angeles daily.
Report a failure the moment it happens
With && the beat only goes out when the job succeeds, so a failure waits out the grace window before anyone hears about it. Put the exit status in the path and Mast knows straight away:
17 3 * * * /usr/local/bin/backup.sh >/tmp/backup.log 2>&1; \
curl -fsS -m 10 --data-binary @/tmp/backup.log \
"https://mast.tissue.dev/mk_8e2a…/$?" >/dev/null
/0- A beat. Nothing rings, whatever the body says.
/1to/255- Down right now. The card reads
nightly-backup exited 17. /fail- Down the same way, for a job with no exit code to give.
/start- Opens a run. Set a longest run on the heartbeat and a job still going past it goes down with is still running, which catches the job that hung holding a lock.
The body is kept as the job's output: up to 16 KiB on the wire, and the history keeps the first 4096 characters. The last 200 beats stay in the history for up to 30 days, with the run length on each one that closed a /start. Run signals has the details.
Recipes for the usual schedulers
Each one is a complete working setup.
- Backup jobs
- A nightly database backup with the exit code, the log as the body, and a longest run so a stuck backup pages too.
- GitHub Actions
- A scheduled workflow that beats on success and reports failure, and what GitHub's own schedule limits mean for it.
- systemd timers
- A timer and a oneshot service, with the beat in
ExecStartPost=or the exit status fromExecStopPost=. - Kubernetes CronJobs
- A CronJob that reads the heartbeat URL from a Secret and beats with its own exit code.
- Windows Task Scheduler
- A PowerShell script that sends its exit code with
Invoke-WebRequest, registered withschtasks. - Home Assistant
- A heartbeat that pages you when Home Assistant itself stops.
Setting one up
- In the web app, open Heartbeats and then New heartbeat. Give it a name and say how often the job runs: every hour, every day, or a crontab line with its time zone. It hands you the URL and the line to paste.
- Give it some grace, meaning how late is still fine. A backup that usually takes four minutes and sometimes twenty wants twenty minutes of grace.
- Run the job by hand once. The heartbeat's row shows the beat and when the next one is due.
Over the API, a heartbeat is an alert source with kind: "heartbeat":
curl -X POST https://api.tissue.systems/v1/mast/alert-sources \
-H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \
-d '{"name": "nightly-backup", "kind": "heartbeat",
"period_secs": 86400, "grace_secs": 3600, "heartbeat_priority": "loud"}'
The URL is a write capability. Anyone who has it can beat the heartbeat, so keep it in a secret store or an environment file and out of anything you commit.
How the page reaches you
A heartbeat that goes down pages through Mast Pager on iPhone and Android. A page repeats every two minutes until somebody acknowledges it. It's time-sensitive, so it breaks through Focus, and with Critical Alerts turned on in the app on iPhone, or Do Not Disturb access on Android, it rings through the silent switch too. On Team and Company an escalation policy can hand it to the next person, follow a rotation, or phone them. The same alert can also go to Slack, Discord, Teams, an inbox or a webhook of your own.
What it costs
| Plan | Price | Heartbeats | History |
|---|---|---|---|
| Free | $0, no card | 10 | 7 days |
| Team | $29 a month or $290 a year | 250 | 90 days |
| Company | $149 a month or $1,490 a year | 2,000 | 365 days |
Each plan also counts probes and alert sources, and Team and Company include phone calls and rotations. Both paid plans start with a 14-day trial. The pricing page has the whole table.
Free is ten heartbeats, ten probes and ten alert sources for up to five people. Team is $29 a month for 250 heartbeats, with rotations and escalation for as many people as you have.