Cron Job Failed? How to Detect & Fix in 5 Min
Your cron job failed or stopped running—and you need to fix it fast. Step-by-step: detect why it failed, fix it, then set up monitoring so you get alerts next time.
How to Check if Your Cron Job is Running
First, verify whether the cron job is actually running. Here are the diagnostic steps:
1. Check Cron Logs
Most Linux distributions log cron activity. Check these locations:
# Check system cron logs
sudo tail -f /var/log/cron
sudo tail -f /var/log/syslog | grep CRON
# Check user cron logs (if enabled)
grep CRON /var/log/auth.log2. Verify Cron Service is Running
# systemd
systemctl status cron
systemctl status crond
# Check if cron daemon is running
ps aux | grep cron3. List Your Cron Jobs
# View current user's crontab
crontab -l
# View root crontab
sudo crontab -l4. Check for Syntax Errors
Cron silently ignores jobs with syntax errors. Validate your crontab:
# Validate crontab syntax
crontab -l | crontab -
# Check for common issues
crontab -l | grep -v "^#" | grep -v "^$"Common Reasons Cron Jobs Stop Running
1. Cron Service Stopped or Disabled
The cron daemon might have been stopped or disabled. Restart it:
# systemd
sudo systemctl start cron
sudo systemctl enable cron2. Incorrect PATH or Environment Variables
Cron runs with a minimal environment. Your script might fail because PATH doesn't include necessary directories. Fix by using absolute paths or setting PATH in your crontab:
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash
0 3 * * * /usr/local/bin/backup.sh3. Permission Issues
The script might not be executable, or the user running cron doesn't have permission:
# Make script executable
chmod +x /path/to/script.sh
# Check file ownership
ls -l /path/to/script.sh4. Script Errors Not Being Logged
If your script fails, cron won't tell you unless you redirect output. Always log errors:
0 3 * * * /path/to/script.sh >> /var/log/script.log 2>&15. Disk Space or Resource Limits
Check if disk space or other resources are exhausted:
# Check disk space
df -h
# Check inodes
df -iHow to Detect Cron Job Failures Automatically
Manual checks are reactive. You need proactive monitoring that alerts you when a cron job doesn't run. A dead man switch is the simplest solution. With a proper cron notification system, you'll get a cron notification if is not working, ensuring you're immediately alerted when your cron job fails or stops running.
A cron job notification service monitors your scheduled tasks and sends cron notification alerts when something goes wrong. If your cron notification is not working, it means your job didn't complete successfully. The cron notification when job fails provides instant feedback, so you can fix issues before they impact your business.
- Your cron job pings a monitoring service after each successful run
- If the ping doesn't arrive within the expected interval, you get an alert
- Works with any cron job, any language, any environment
- No complex setup, just add a curl command
Quick Setup Example
0 3 * * * /path/to/backup.sh && curl -X POST "https://deadmanping.com/api/ping/backup-daily"If backup.sh fails or doesn't run, the ping never happens, and you get an alert.
Never Miss a Cron Job Failure Again
DeadManPing provides dead man switch monitoring for cron jobs. Set up monitoring in 2 minutes, get instant alerts when jobs fail, and sleep peacefully knowing you'll be notified immediately.
Related Articles
Learn more about cron job monitoring and troubleshooting:
Monitor Cron Jobs: One Curl Line, No Migration
Monitor cron jobs with one curl line. No SDK, no migration—get alerts when jobs fail.
Detect Hanging Cron Job: Timeout & Execution Time Monitoring
Detect cron job timeouts and stuck scripts with start/stop tracking.
Cron Job Not Executing
How to detect when cron jobs are not executing.
Verify Cron Job Actually Ran
How to verify that cron jobs actually executed.
Cron Job Exit Code Not Zero
How to detect when cron jobs exit with non-zero exit codes.