Learn how to monitor cron jobs, detect missed runs, and choose a reliable completion signal for backups, scheduled scripts, and data synchronization.
Stop missing failed cron jobs. Start monitoring free with PingCron →
Cron starts commands on a schedule. It does not prove that a command finished, produced valid output, or ran at all. A host can go offline, a deployment can remove a crontab, or a script can stop working after its environment changes. If nothing starts, there may be no application exception to report.
Effective cron job monitoring checks for an expected result by a deadline. Combine evidence of successful completion with logs that explain failures. For important jobs, validate the output before reporting success.
Useful for: confirming that cron attempted to launch a command and finding permission, service, or configuration errors. Inspect the logs available on your operating system, such as cron logs or the system journal.
Limitation: a launch record is not proof of completion. Logs on an unavailable host cannot alert you by themselves. Add an external check or a rule that detects missing events.
Useful for: stack traces, failed API calls, validation failures, and other details needed to repair a job. Record a run ID, start and finish time, exit status, and a safe summary of the output.
Limitation: an exception handler cannot run when the scheduler never starts the process. Avoid logging secrets or relying only on error events for cron job failure detection.
Useful for: tracking duration, failure counts, processed records, and time since last successful completion. This fits teams with an existing metrics platform and alert ownership.
Limitation: instrumentation and alert rules require maintenance. A counter that stops changing must trigger an absence or freshness rule; an error-rate alert alone may stay quiet.
Useful for: missed cron job alerts. After the workload and its validation succeed, the job sends an HTTPS check-in to a cron job monitor. The monitor expects that signal within the configured schedule and grace period.
Limitation: a missing heartbeat is ambiguous: work may have failed, never started, run too long, or completed while the check-in failed. Cron heartbeat monitoring complements logs and output validation; it does not replace them.
Choose by need: use logs to investigate, metrics to understand trends, and an external heartbeat to detect silence. A small team can start with completion heartbeats and useful logs, then add deeper metrics where they change an operational decision.
PingCron monitors completion signals from your existing scheduler. It does not run or restart the workload. Its free plan currently supports five monitors with email, Slack, and Discord alerts; outbound webhooks are a paid-plan feature.
Create a monitor with a clear job name, such as “nightly backup”.
Copy its unique success endpoint and store it as PINGCRON_URL in the environment of the actual scheduled process. Treat the URL as a secret; do not put it in public code or logs.
Match the expected schedule or interval and time zone. Allow enough grace for normal runtime and queue delays, while keeping the detection window useful.
Configure the account owner's alert destination. Verify a successful receipt, then test a missed check-in with a separate test monitor.
Save this Bash wrapper as /opt/jobs/monitored-backup.sh. Replace the workload path with your executable backup-and-validation script. That script must return zero only after its checks pass.
#!/bin/bash
/opt/jobs/backup-and-verify.sh
job_status=$?
if [ "$job_status" -eq 0 ]; then
if [ -z "${PINGCRON_URL:-}" ]; then
printf '%s\n' 'Heartbeat not configured' >&2
elif code=$(curl -q --silent \
--output /dev/null \
--write-out '%{http_code}' \
--connect-timeout 3 --max-time 10 \
-- "$PINGCRON_URL"); then
case "$code" in
2??) ;;
*) printf '%s\n' 'Heartbeat not confirmed' >&2 ;;
esac
else
printf '%s\n' 'Heartbeat not confirmed' >&2
fi
fi
exit "$job_status"
Make the wrapper executable, then replace the existing schedule with this entry. Do not schedule both the wrapper and the original job:
0 2 * * * /opt/jobs/monitored-backup.sh
This runs at 02:00 in the scheduler's configured time zone. Cron may not inherit your interactive shell's environment: provide the private endpoint through your deployment or secrets mechanism. Do not paste it into this guide.
The wrapper checks for a 2xx HTTP response, bounds the network call, avoids following redirects, and preserves the workload's exit status. A heartbeat error is logged separately. It never retries the backup just because reporting failed.
For complete Bash, Python, and Node.js implementations, environment setup, and a safe test sequence, read How to Detect Failed Cron Jobs Before They Cause Problems. You can also open the original Google Doc to download the examples.
Stop missing failed cron jobs. Start monitoring free with PingCron →
Nightly backups: check that the artifact exists, is recent, and passes the backup tool's verification. Rehearse restoration separately; an uploaded file alone does not prove recoverability.
Scheduled scripts: confirm the expected report or output was produced, and check that an empty result is actually valid. Emit the heartbeat after these checks, not when the process starts.
Automated data synchronization: verify the destination watermark or expected batch and commit the transaction before checking in. A successful HTTP response from one source request does not prove the full synchronization finished.
No run appears: check the scheduler service, crontab owner, executable permissions, absolute paths, working directory, and the environment available to cron.
Work succeeded but the monitor is late: check that the same scheduled process received PINGCRON_URL. Inspect safe error messages, DNS/TLS connectivity, timeouts, and the HTTP result without exposing the endpoint.
Alerts arrive during normal runs: compare the time zone, expected completion time, typical duration, and grace period. Consider queue delays, daylight-saving changes, and overlapping runs.
The dashboard is down but no notification arrived: verify the account owner's alert destination and inspect the notification path. Missed runs become eligible after the expected window; periodic checks, queues, retries, and providers can add delay.
Bad output still looks healthy: move the heartbeat after validation and ensure failure paths return a nonzero status. Give independent jobs separate monitors.
It checks whether scheduled jobs complete within an expected window and helps surface failures, missing executions, or stale results. Scheduled task monitoring applies the same idea to other schedulers.
An external monitor can notice the missing completion signal even when the host or scheduler is unavailable. An error handler inside the job cannot do that by itself.
Only that execution reached the check-in. Validate the business result first. Heartbeats do not prove data quality, prevent duplicate work, diagnose root causes, or restore failed jobs.
A success check-in reports completion. PingCron also documents an explicit failure endpoint for code that knows it failed. No check-in means the monitor must wait for the expected window and grace period. An explicit failure signal is optional; it cannot replace detection of jobs that never run.
Use a separate test monitor. Confirm one successful receipt, intentionally skip a check-in, wait beyond the configured window and detection delay, verify the alert, then restore successful check-ins and verify recovery. Do not disable a production backup to test an alert.
See the current official PingCron cron monitoring guide for product behavior and curl documentation for HTTP options. For implementation details, use the linked companion Google Doc above.