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.

Category
Troubleshooting · Servers & Linux
Time
15–30 min
Last reviewed
What you'll need
  • SSH or console access with sudo

Step-by-step diagnostic

Step 1 of 9
Show full guide

Steps

Goal: Check crontab syntax, PATH and environment, cron daemon, and logs.

  • Run crontab -l to 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 -e and 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 cron or systemctl status crond. If inactive, start it.
  • Run grep CRON /var/log/syslog (Debian/Ubuntu) or journalctl -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 -l shows 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.

  1. Crontab and syntax crontab -l; confirm syntax and job exists.
  2. PATH and environment Add SHELL, PATH, HOME to crontab; use full paths.
  3. Cron daemon and logs systemctl status cron; grep CRON /var/log/syslog or journalctl.
  4. Permissions chmod +x script; check file access.
  5. 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.

Run `crontab -l`. Good: job exists and syntax is valid. Bad: job missing or syntax wrong—fix and save. Confirm you should see the job.

You can change your answer later.

Fix crontab syntax

Edit with `crontab -e`. Format: minute hour day month weekday command. Use * for any. Save and exit. Confirm you should see the job in crontab -l.

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.

Run the command as the cron user with minimal env. Good: works—check cron daemon and logs. Bad: fails—add SHELL, PATH, HOME to crontab; use full paths.

You can change your answer later.

Add PATH and environment to crontab

Add at top of crontab: SHELL=/bin/bash, PATH=/usr/local/bin:/usr/bin:/bin, HOME=/home/user. Use full paths for commands. Confirm you should see the job run on next schedule.

Is the cron daemon running?

systemctl status cron (Debian) or systemctl status crond (RHEL).

Run `systemctl status cron` or `systemctl status crond`. Good: active (running). Bad: inactive—run `sudo systemctl start cron`. Confirm you should see active.

You can change your answer later.

Start cron daemon

Run `sudo systemctl start cron` or `sudo systemctl start crond`. Enable for boot: `sudo systemctl enable cron`. Confirm you should see active.

What do the logs show?

grep CRON /var/log/syslog or journalctl -u cron -n 50.

Check logs for the job run or error. Permission denied: fix chmod/chown. No such file: fix PATH or use full path. Other: escalate with crontab, logs, and manual output.

You can change your answer later.

Done

Job runs on schedule. Monitor logs to confirm.

Escalate

Provide crontab -l, cron logs, and output of running the command manually. Escalate if managed by config management.

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.

Continue to