← Back to Blog

How to Monitor Cron Jobs in Production (5-Minute Setup)


title: "How to Monitor Cron Jobs in Production (5-Minute Setup)" description: "A practical guide to monitoring cron jobs in production. Learn how to set up dead man's switch monitoring with one curl command and never miss a silent failure again." publishedAt: "2026-03-10" author: "SwiftLabs Team"

How to Monitor Cron Jobs in Production (5-Minute Setup)

Cron jobs fail silently. A database backup that hasn't run in three weeks. A data sync that stopped working after a deployment. An invoice generator that quietly broke during a dependency update.

You only find out when it's too late.

This guide shows you how to set up production-grade cron job monitoring in 5 minutes using a dead man's switch pattern.

The Problem with Cron Jobs

Traditional monitoring tells you when things crash. Cron job monitoring needs to tell you when things don't happen.

Your cron job doesn't log errors when:

  • The cron daemon stops
  • Your server runs out of disk space and cron can't write logs
  • A silent exception gets swallowed
  • A dependency changes and your script exits early
  • The entire server goes down

Exit codes won't save you. Log files won't save you. You need a dead man's switch.

What Is a Dead Man's Switch?

A dead man's switch expects regular check-ins. If a check-in doesn't arrive on schedule, it alerts you.

Instead of asking "did this fail?", it asks "did this succeed?". Absence of success = failure.

For cron jobs, this means:

  1. Your cron job pings a monitoring endpoint on success
  2. The monitor expects a ping within a specific time window
  3. If no ping arrives, you get alerted

5-Minute Setup with CronMonitor

Step 1: Create a Monitor (30 seconds)

Sign up at CronMonitor and create a new monitor:

  • Name: Daily database backup
  • Expected interval: 24 hours
  • Grace period: 2 hours

You'll get a unique ping URL:

https://cronmonitor.swiftlabs.dev/api/ping/a3f8c9d2-7e4b-4a1c-9f3e-8d2c7b4a1e6f

Step 2: Add One Line to Your Cron Job (1 minute)

Update your crontab to ping the URL after success:

0 2 * * * /scripts/backup-database.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/a3f8c9d2-7e4b-4a1c-9f3e-8d2c7b4a1e6f

The && ensures the ping only happens if the script succeeds.

Step 3: Configure Alerts (1 minute)

Set up your notification preferences:

  • Email alerts - Get an email when a ping is missed
  • Webhook alerts - Send to Slack, Discord, PagerDuty, or any webhook endpoint

Step 4: Test It (2 minutes)

Run your cron job manually:

/scripts/backup-database.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/a3f8c9d2-7e4b-4a1c-9f3e-8d2c7b4a1e6f

Check the CronMonitor dashboard. You should see the ping logged with a timestamp.

To test the alert:

  1. Don't ping for longer than your expected interval + grace period
  2. Wait for the alert (CronMonitor checks every minute)
  3. Verify you receive the email or webhook

Done. Your cron job is monitored.

Advanced Patterns

Multiple Cron Jobs

Monitor different jobs with different intervals:

# Daily backup (24h interval)
0 2 * * * /scripts/backup.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/backup-token

# Hourly sync (1h interval)
0 * * * * /scripts/sync.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/sync-token

# Weekly report (7d interval)
0 9 * * 1 /scripts/report.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/report-token

Webhook Integration

Send alerts to Slack:

  1. Create a Slack webhook: https://hooks.slack.com/services/T00/B00/XXX
  2. Add it to your CronMonitor settings
  3. When a ping is missed, you'll get a Slack notification

Retry Logic

Add retries for network issues:

0 2 * * * /scripts/backup.sh && curl -fsS --retry 3 --retry-delay 5 https://cronmonitor.swiftlabs.dev/api/ping/token

Logging the Ping

Capture the ping response for debugging:

0 2 * * * /scripts/backup.sh && curl -fsS https://cronmonitor.swiftlabs.dev/api/ping/token > /tmp/ping.log 2>&1

What to Monitor

Not every cron job needs monitoring. Focus on:

  • Data integrity jobs - Database backups, ETL pipelines, data validation
  • Business-critical jobs - Invoice generation, payment processing, order fulfillment
  • Security jobs - Certificate renewal, log rotation, access audits
  • Health checks - Service uptime checks, disk space monitoring, dependency validation

Skip monitoring for:

  • Truly optional jobs where failure doesn't matter
  • Jobs that run so frequently (every minute) that transient failures are acceptable
  • Development or staging environments (unless you're testing the monitoring itself)

Troubleshooting

Ping Not Showing Up

Check:

  1. The curl command succeeds (run it manually)
  2. The token is correct (copy from dashboard)
  3. Network connectivity from your server
  4. Firewall rules allow outbound HTTPS

False Positives

If you're getting alerts but the job is running:

  1. Check the grace period - might be too short
  2. Verify the expected interval matches your cron schedule
  3. Look for script failures that happen before the ping

Late Pings

If pings arrive late:

  1. Check server time (use date and compare to UTC)
  2. Look for long-running tasks before the ping
  3. Increase the grace period to account for normal variance

Free Tier

CronMonitor's free tier includes:

  • 3 monitors
  • Email alerts
  • Webhook alerts
  • Ping history
  • Unlimited pings

Perfect for side projects and small deployments.

Conclusion

Monitoring cron jobs is simple:

  1. Add a ping URL to your crontab
  2. Set an expected interval
  3. Get alerted when pings stop

Five minutes now saves hours of debugging later.

Try CronMonitor — no credit card required.