uptimeMonitoruptimeMonitor
Back to Blog
Guides

Cron Job Monitoring: How to Know When Your Scheduled Tasks Fail

Cron jobs fail silently. Backups don't run, reports don't send, data doesn't sync — and nobody notices for days. Here's how heartbeat monitoring fixes that.

UT
UptimeGuard Team
March 22, 20269 min read4,055 views
Share
cronheartbeatscheduled-tasksmonitoringbackups

Cron Job Monitoring: How to Know When Your Scheduled Tasks Fail

Here's a horror story that's far too common: your nightly database backup has been silently failing for three weeks. You only find out when you actually need to restore from backup — and there's nothing there.

Why Cron Jobs Are So Hard to Monitor

Traditional uptime monitoring checks whether a service is available. But cron jobs don't run continuously — they run on a schedule.

Failure modes:

  • The job doesn't start (cron daemon died, server rebooted)
  • The job starts but doesn't finish (hangs, runs out of memory)
  • The job finishes but fails silently (returns exit code 0 despite errors)
  • The job takes too long
  • The job runs too frequently (duplicate execution)

The Solution: Heartbeat Monitoring

Instead of monitoring checking your job, your job checks in with monitoring.

#!/bin/bash
pg_dump mydb > /backups/daily.sql
curl -s https://monitor.example.com/heartbeat/abc123

If the ping doesn't arrive within the expected window, you get alerted.

What to Monitor with Heartbeats

JobExpected IntervalGrace Period
Database backup24 hours1 hour
Queue processor5 minutes2 minutes
Temp cleanup1 hour15 minutes
Weekly report7 days4 hours

Advanced Patterns

  • Start + End Pings — Detect jobs that start but hang
  • Exit Code Reporting — Track success vs failure
  • Duration Monitoring — Alert if a job takes longer than expected
  • Output Logging — Send job output with the heartbeat for debugging

Two minutes of setup to prevent weeks of silent failures. Your cron jobs are running right now. Do you know if they're succeeding?

Share
UT

Written by

UptimeGuard Team

Related articles