Never let a cron fail silently without knowing again
A "silent" cron represents one of the most insidious problems in system administration. Unlike a cron that fails with a visible error, a silent cron simply stops running without generating any error message. No alert email, no error log, no notification: the cron disappears into the shadows while your data becomes stale.
This problem is particularly vicious because it can go unnoticed for days, even weeks. How many times have you discovered that a backup hadn't been running for two weeks? Or that a daily import had stopped a week ago, leaving your customer data incomplete? These situations are far more common than we think.
The solution lies in "heartbeat" monitoring: instead of waiting for an error that will never come, you actively wait for a life signal. If that signal (ping) doesn't arrive on time, you're alerted. MoniTao implements this pattern to protect you against silent crons.
Several clues can reveal that a cron has silently stopped working:
Understanding the causes helps prevent recurrence:
When facing a suspect cron, follow this diagnostic methodology:
Here's how to integrate a MoniTao heartbeat to detect a silent cron:
#!/bin/bash
# Script: /home/scripts/import-data.sh
set -e # Stop on error
echo "[$(date)] Starting import..."
# Your business logic
/usr/bin/php /var/www/app/import.php
# Ping MoniTao only if script succeeded
if [ $? -eq 0 ]; then
curl -fsS --max-time 10 \
"https://api.monitao.com/ping/your-token" \
-d '{"status": "success"}' \
-H "Content-Type: application/json"
echo "[$(date)] Import completed successfully, ping sent"
else
echo "[$(date)] Import failed, no ping"
exit 1
fi
This script pings MoniTao only on success. If the script doesn't run at all (silent cron), or if it fails, no ping is sent. MoniTao alerts you after the configured grace period, informing you that something is wrong.
MoniTao offers several approaches to automate silent cron detection:
Adopt these practices to minimize silent cron risks:
A cron is critical if its absence would have visible business impact: backups (data loss), imports (stale data), email sending (interrupted communication), synchronizations (system misalignment). Prioritize those whose failure would cost the most in time or money.
The ping typically takes 50-200ms depending on network latency. For a cron that runs for several minutes, this is negligible. For ultra-fast crons (< 1 second), you can use the --max-time option to limit wait time and prevent a network issue from blocking the cron.
Two options: 1) Configure an outbound proxy for HTTP calls to MoniTao. 2) Use an intermediate server with internet access that relays pings. The cron server pings the local relay, which pings MoniTao.
It depends on your architecture: if all 3 servers should run the cron, create 3 distinct heartbeats (one per server). If only one should run (e.g., master/slave), create a single heartbeat and ensure only the master pings.
A silent cron doesn't run at all (no log, no trace). A failing cron runs but returns an error. With MoniTao, use conditional ping (&&): no ping = either silent or failed. Your internal logs help differentiate.
Yes, MoniTao supports multiple alert channels: email, Slack, Discord, custom webhooks, and more. Configure your preferences in your account notification settings. You can even combine multiple channels for the most critical crons.
Silent crons are ticking time bombs. They stop working without a sound, accumulating invisible technical debt until the day the consequences become obvious: lost data, frustrated customers, production incidents. Prevention is infinitely cheaper than repair.
Heartbeat monitoring reverses the paradigm: instead of waiting for errors that never come, you wait for life signals. Their absence triggers the alert. With MoniTao, set up this protection in minutes for each of your critical crons, and sleep peacefully.
Start free, no credit card required.