Fix a cron job that will not run
We'll check crontab syntax, PATH and environment, cron daemon status, and logs—or tell you when to escalate.
What you'll need
- SSH or console access with sudo
Step-by-step diagnostic
Quick triage — pick your path
Get started
Choose the option that matches what you see. You can jump straight to that section.
- Follow this guide Work through the full procedure.
- Check crontab and syntax You want to confirm the job is installed and the syntax is correct.
- Fix PATH and environment The command works manually but not in cron.
- Check logs and daemon You want to see the error first.
- When to escalate Config management or application-level fix needed.
Show full guide
Steps
Goal: Check crontab syntax, PATH and environment, cron daemon, and logs.
- Run
crontab -lto confirm the job exists and the syntax is correct. - Good: Job is present with valid syntax. Proceed to Fix PATH and environment.
- Bad: Job missing or syntax wrong—edit with
crontab -eand fix.
Check crontab and syntax
Goal: Confirm the job is installed and the format is valid.
- Cron format: minute (0–59), hour (0–23), day (1–31), month (1–12), weekday (0–7), then command. Use * for any.
- Good: Five fields followed by the command. Proceed to Fix PATH and environment.
- Bad: Fix syntax and save.
Fix PATH and environment
Goal: Set SHELL, PATH, and HOME so the command runs in cron.
- Add at the top of the crontab:
SHELL=/bin/bash,PATH=/usr/local/bin:/usr/bin:/bin,HOME=/home/youruser. - Use full paths for the command and any files. Test with
env -i HOME=$HOME PATH=/usr/bin:/bin /path/to/command. - Good: Command runs with minimal env. Proceed to Check logs and daemon.
- Bad: Add missing vars or paths to the crontab.
Check logs and daemon
Goal: Confirm the cron daemon is running and see what happens when the job runs.
- Run
systemctl status cronorsystemctl status crond. If inactive, start it. - Run
grep CRON /var/log/syslog(Debian/Ubuntu) orjournalctl -u cron -n 50(RHEL). - Good: Daemon is active; logs show the job or the error. Fix permissions or paths as needed.
- Bad: Daemon not running—start it. Logs unclear—run the command manually and escalate with output.
When to escalate
Escalate if:
- The cron is managed by config management (Puppet, Ansible, Chef).
- The fix requires application-level changes.
- You cannot access the server.
Provide crontab -l, cron logs, and the output of running the command manually.
Verification
crontab -lshows the job with correct syntax.- Cron daemon is active (running).
- Logs show the job running at the scheduled time, or the error is identified and fixed.
- The command produces the expected result when run by cron.
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Crontab and syntax crontab -l; confirm syntax and job exists.
- PATH and environment Add SHELL, PATH, HOME to crontab; use full paths.
- Cron daemon and logs systemctl status cron; grep CRON /var/log/syslog or journalctl.
- Permissions chmod +x script; check file access.
- Escalate Provide crontab, logs, and manual run output.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- crontab -l output
- Cron logs (grep CRON or journalctl)
- Output of running the command manually
- Steps already tried
Is the job in crontab with correct syntax?
Run crontab -l. Check five fields (minute hour day month weekday) followed by command.
You can change your answer later.
Fix crontab syntax
Does the command work when run manually with minimal env?
Cron runs with minimal PATH. Test with env -i HOME=$HOME PATH=/usr/bin:/bin /path/to/command.
You can change your answer later.
Add PATH and environment to crontab
Is the cron daemon running?
systemctl status cron (Debian) or systemctl status crond (RHEL).
You can change your answer later.
Start cron daemon
What do the logs show?
grep CRON /var/log/syslog or journalctl -u cron -n 50.
You can change your answer later.
Done
Escalate
Reviewed by Blackbox Atlas
Frequently asked questions
- Why would a cron job not run?
- Wrong PATH or environment, crontab syntax error, wrong user, cron daemon not running, or permission denied. Check crontab -l and logs first.
- Can I fix a cron job that will not run myself?
- Yes. Fix crontab syntax, set PATH and SHELL in the crontab, confirm the cron daemon is running, and check logs for errors.
- When should I escalate cron job failures?
- If the job is managed by config management, the fix requires application changes, or you cannot access the server.
Rate this guide
Was this helpful?
Thanks for your feedback.