Cron job monitoring
Free cron job, backup and CI monitoring with heartbeats
A backup that silently stops running looks exactly like a backup that works, until the day you need it. A heartbeat flips that around: the job reports in when it's done, and FlareWatch tells you when it doesn't.
Nightly backuplast 26 runs
- on time
- on time
- on time
- on time
- on time
- on time
- on time
- on time
- on time
- late
- on time
- on time
- on time
- on time
- on time
- on time
- missed
- on time
- on time
- on time
- on time
- on time
- failed
- on time
- on time
- running
on timelatefailedmissedrunning
How it works
- You say how often the job runs and how late it may be. FlareWatch expects a ping inside that window.
- The monitor goes down when the ping doesn't arrive in time, or when the job reports a failure. You get the same alerts as for any other monitor.
- Heartbeats show on the status page next to your websites and APIs, and they can depend on another monitor, like the server the job runs on.
{
id: 'nightly-backup',
name: 'Nightly backup',
method: 'HEARTBEAT',
periodSeconds: 86400, // how often the job runs
graceSeconds: 3600, // how late it may be
}In packages/config/src/worker.ts of your fork.
Ping URLs
Each heartbeat has its own URL with a secret token, so nobody else can report for your job.
| Method | Route | Means |
|---|---|---|
| GET, POST, HEAD | /ping/<id>/<token> | The job finished. |
| GET, POST | /ping/<id>/<token>/start | The job started. |
| POST | /ping/<id>/<token>/fail | The job failed. The body is the message. |
| GET, POST | /ping/<id>/<token>/<0-255> | The job exited with this code. 0 is fine. |
Pings are limited to 30 a minute per monitor, which stops a looping script. Jobs that run every minute are fine.
Examples
Ping on success
./backup.sh && curl -fsS "https://status.example.com/ping/nightly-backup/<token>"Send the exit code, so a failure shows at the next check
./backup.sh; curl -fsS "https://status.example.com/ping/nightly-backup/<token>/$?"In a crontab
0 3 * * * /usr/local/bin/backup.sh; curl -fsS "https://status.example.com/ping/nightly-backup/<token>/$?"With systemd
[Service]
Type=oneshot
ExecStartPre=/usr/bin/curl -fsS https://status.example.com/ping/nightly-backup/<token>/start
ExecStart=/usr/local/bin/backup.sh
ExecStopPost=/usr/bin/curl -fsS "https://status.example.com/ping/nightly-backup/<token>/${EXIT_STATUS}"