Tools: How to Monitor Your Cron Jobs in Production (So They Don't Silently Die) - 2025 Update

Tools: How to Monitor Your Cron Jobs in Production (So They Don't Silently Die) - 2025 Update

How to Monitor Your Cron Jobs in Production (So They Don't Silently Die)

The Dead Man's Switch Pattern

Implementation

Grace Periods

Failure Modes

Setting Up CronPing

Best Practices Every production system has cron jobs. Database backups, report generation, cache warming, email digests — the list grows with your product. But here's the thing: cron jobs fail silently. Your backup script has been failing for 3 weeks? Nobody knows until you need to restore. Your nightly ETL hasn't run since the last deploy? You'll find out when the CEO asks why the dashboard is stale. The most reliable way to monitor cron jobs is the dead man's switch (or heartbeat) pattern: This is fundamentally different from log monitoring because it catches jobs that never start — not just jobs that start and fail. Here's how it works with a simple HTTP endpoint: The && is critical — it only pings if the backup succeeds. If the script exits non-zero, no ping is sent, and you get alerted. Not every job runs at exactly the same time. A good monitoring system lets you set a grace period — extra time before an alert fires. For a daily backup that usually takes 10 minutes: Heartbeat monitoring catches every failure mode because it monitors for the absence of a signal rather than the presence of an error. I built CronPing to make this dead-simple: Free tier gives you 3 monitors — enough for most side projects. CronPing is free for up to 3 monitors. Try the cron expression helper to build your cron schedules. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

# Your existing cron job 0 2 * * * /usr/local/bin/backup.sh # Add monitoring - ping after success 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/YOUR_TOKEN # Your existing cron job 0 2 * * * /usr/local/bin/backup.sh # Add monitoring - ping after success 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/YOUR_TOKEN # Your existing cron job 0 2 * * * /usr/local/bin/backup.sh # Add monitoring - ping after success 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/YOUR_TOKEN # 1. Sign up -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/signup \ -H 'Content-Type: application/json' \ -d '{ "email": "[email protected]" }' # 2. Create a monitor -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/monitors \ -H 'Authorization: Bearer ch_xxx...' \ -H 'Content-Type: application/json' \ -d '{ "name": "nightly-backup", "schedule_minutes": 1440, "grace_minutes": 30 }' # 3. Add the ping to your cron job 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/xxx # 1. Sign up -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/signup \ -H 'Content-Type: application/json' \ -d '{ "email": "[email protected]" }' # 2. Create a monitor -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/monitors \ -H 'Authorization: Bearer ch_xxx...' \ -H 'Content-Type: application/json' \ -d '{ "name": "nightly-backup", "schedule_minutes": 1440, "grace_minutes": 30 }' # 3. Add the ping to your cron job 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/xxx # 1. Sign up -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/signup \ -H 'Content-Type: application/json' \ -d '{ "email": "[email protected]" }' # 2. Create a monitor -weight: 500;">curl -X POST https://cronping.anethoth.com/api/v1/monitors \ -H 'Authorization: Bearer ch_xxx...' \ -H 'Content-Type: application/json' \ -d '{ "name": "nightly-backup", "schedule_minutes": 1440, "grace_minutes": 30 }' # 3. Add the ping to your cron job 0 2 * * * /usr/local/bin/backup.sh && -weight: 500;">curl -fsS https://cronping.anethoth.com/ping/xxx - Create a monitor with an expected schedule - Your cron job pings the monitor after completing successfully - If the monitor doesn't receive a ping within the expected window, fire an alert - Schedule: every 1440 minutes (24 hours) - Grace period: 30 minutes - Alert fires if no ping received within 24.5 hours of the last one - Always use && — only ping on success - Use -fsS with -weight: 500;">curl — fail silently on network errors but show server errors - Set realistic grace periods — too tight causes false alarms - One monitor per job — don't reuse ping tokens