Cron Job Not Running? How to Diagnose and Fix
Common ErrorsThe Problem
You've added a cron job but it never executes. The crontab entry looks correct, but nothing happens at the scheduled time.
The Solution
Check the most common culprits: cron daemon status, PATH configuration, permissions, output redirection, and environment differences.
1. Is Cron Running?
Check if the cron daemon is active with systemctl status cron (or crond on CentOS). If it's not running, start it with systemctl start cron.
2. Check Your Crontab
Run crontab -l to verify your entry exists. Common mistakes: wrong cron syntax, editing the wrong user's crontab, or using /etc/crontab without a username field.
3. PATH Issues
Cron uses a minimal PATH (/usr/bin:/bin). If your script calls python3, node, or other commands, use absolute paths or set PATH at the top of your crontab.
4. Permissions
Ensure your script is executable (chmod +x script.sh) and the cron user has access to all files and directories the script uses.
Add Monitoring to Prevent Future Blind Spots
Even after fixing, add CronRabbit monitoring so you get alerted instantly if the job stops running again.
Code Examples
Diagnostic commands
Bash# Check if cron is running
systemctl status cron
# Check your crontab
crontab -l
# Check cron logs
grep CRON /var/log/syslog | tail -20
# Test your script manually
/bin/bash /path/to/your/script.sh
# Check permissions
ls -la /path/to/your/script.sh