Skip to content
FlareWatch

Docs and changelog for v3.5.0.

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
  1. on time
  2. on time
  3. on time
  4. on time
  5. on time
  6. on time
  7. on time
  8. on time
  9. on time
  10. late
  11. on time
  12. on time
  13. on time
  14. on time
  15. on time
  16. on time
  17. missed
  18. on time
  19. on time
  20. on time
  21. on time
  22. on time
  23. failed
  24. on time
  25. on time
  26. 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.

MethodRouteMeans
GET, POST, HEAD/ping/<id>/<token>The job finished.
GET, POST/ping/<id>/<token>/startThe job started.
POST/ping/<id>/<token>/failThe 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}"