Cron Jobs Not Executing - Troubleshooting Guide
Cron jobs not executing? Quick steps to identify execution issues, fix cron configuration, and restore scheduled task functionality.
Cron Jobs Not Executing - Troubleshooting Guide
Cron jobs aren't running, scheduled tasks are missed, backups aren't executing. This guide gives you immediate steps to diagnose and fix cron jobs not executing—now. No theory, just action.
For setting up monitoring to prevent this in the future, see Cron Jobs and Scheduled Tasks Monitoring Guide after you've resolved the immediate crisis.
60-Second Triage
Run these commands in order:
# Step 1: Check cron service (takes 5 seconds)
systemctl status cron
# Step 2: View cron jobs (takes 5 seconds)
crontab -l
# Step 3: Check cron logs (takes 10 seconds)
grep CRON /var/log/syslog | tail -20
# Step 4: Verify cron syntax (takes 5 seconds)
crontab -l | grep -v "^#"
Common Cron Issues and Quick Fixes
| Issue | Likely Cause | Quick Fix |
|---|---|---|
| Cron service stopped | Service not running | sudo systemctl start cron |
| Syntax errors | Invalid cron syntax | Fix syntax: crontab -e |
| Path issues | Command not found | Add full paths or PATH in crontab |
| Permission issues | Insufficient permissions | Check file permissions: ls -l script.sh |
Symptoms of Cron Jobs Not Executing
Cron execution issues manifest in several ways:
- Jobs don't run: No execution logs for scheduled jobs
- Cron service errors: Cron daemon shows errors in logs
- Permission denied: Jobs fail with permission errors
- Command not found: Jobs fail because commands aren't found
Step-by-Step Troubleshooting
Step 1: Verify Cron Service
When cron jobs don't execute:
-
Check Cron Service Status:
systemctl status cron -
Start Cron Service if Stopped:
sudo systemctl start cron -
Enable Cron Service:
sudo systemctl enable cron
Step 2: Check Cron Configuration
Once cron service is running:
-
View Cron Jobs:
crontab -l -
Check Cron Syntax:
crontab -l | grep -v "^#" -
Verify Cron Logs:
grep CRON /var/log/syslog | tail -20
Step 3: Fix Cron Issues
When cron issues are identified:
-
Fix Syntax Errors:
crontab -e -
Add Full Paths:
# Add PATH at top of crontab PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -
Fix Permissions:
chmod +x /path/to/script.sh
Step 4: Test Cron Execution
To verify cron jobs execute:
-
Run Job Manually:
/path/to/script.sh -
Check Execution Logs:
grep CRON /var/log/syslog | grep "script-name" -
Monitor Cron Execution:
tail -f /var/log/syslog | grep CRON
Automatic Detection with Zuzia.app
Zuzia.app automatically monitors cron execution and detects failures:
- Checks cron execution logs every few minutes
- Detects missed executions immediately
- Sends alerts when cron jobs don't execute
- Tracks cron execution history
Set up cron monitoring in Zuzia.app to prevent execution issues:
- Add scheduled task:
grep CRON /var/log/syslog | tail -20 - Configure alerts for cron execution failures
- Monitor cron execution continuously
Best Practices for Preventing Cron Execution Issues
1. Monitor Cron Execution Continuously
Don't wait for cron failures:
- Use Zuzia.app for continuous cron monitoring
- Set up alerts before cron issues become critical
- Review cron execution logs regularly
2. Test Cron Jobs Manually
Test cron jobs before relying on them:
- Run jobs manually to verify they work
- Check job output and logs
- Verify job permissions and paths
3. Maintain Cron Documentation
Keep cron documentation current:
- Document all cron jobs
- Maintain cron change logs
- Update documentation when jobs change
FAQ: Common Questions About Cron Execution
How do I know if cron jobs are executing?
Check cron logs: grep CRON /var/log/syslog | tail -20. Verify cron service: systemctl status cron. Check job execution: grep "job-name" /var/log/syslog.
What should I do immediately when cron jobs don't execute?
Immediately check cron service: systemctl status cron. Start cron if stopped: sudo systemctl start cron. Check cron logs: grep CRON /var/log/syslog | tail -20. Verify cron syntax: crontab -l.
Can cron jobs fail silently?
Yes, if cron jobs don't produce output or log errors, they can fail silently. Always check cron logs and job output.
How can Zuzia.app help prevent cron execution issues?
Zuzia.app monitors cron execution logs continuously, detects missed executions immediately, sends alerts when cron jobs don't execute, and tracks cron execution history.