Guide
How to monitor cron jobs
Cron jobs fail silently. The server reboots and cron doesn't restart. The disk fills up and the job exits with an error nobody sees. The job runs but takes 4 hours instead of 5 minutes. Without monitoring, you find out when a customer asks why their report is missing.
HOW IT WORKS
Heartbeat monitoring
Instead of Larm checking your service, your service pings Larm. Create a heartbeat monitor with an expected interval (how often the job should run) and Larm gives you a unique URL. Add a curl to the end of your cron job. If the ping stops arriving, Larm alerts your team.
STEP 1
Create a heartbeat monitor
In Larm, create a new monitor and select "Heartbeat" as the type. Set the expected interval to match your cron schedule. A job that runs every hour gets a 1-hour interval. By default, Larm alerts after two missed pings, with 20% extra time for each, so an hourly job alerts after about 2 hours 24 minutes without a ping. Set consecutive misses to 1 to be alerted after 72 minutes.
STEP 2
Add the ping to your cron job
Copy the heartbeat URL from the monitor and add a curl to the end of your cron command:
The && ensures the ping only fires if the job succeeds. If the job fails, no ping is sent, and Larm alerts you once the allowed misses have passed.
WORKS WITH EVERYTHING
Not just cron
Heartbeat monitoring works for anything that runs on a schedule: Kubernetes CronJobs, Oban workers, Sidekiq recurring jobs, GitHub Actions scheduled workflows, AWS Lambda scheduled events, Windows Task Scheduler. Anything that can make an HTTP request can ping Larm.
Need help building a cron expression? Try our cron expression generator. For why scheduled jobs stop running, and examples for shell scripts, Oban, Sidekiq and systemd timers, see how to monitor cron jobs and background workers.
Know when your cron jobs stop running.
Heartbeat monitoring on every plan. Alert to Slack, PagerDuty, or any of 14+ integrations. Free to start.
Sign Up Free