← Back to all fixes

Cron job not running as expected

The Issue

You added a crontab entry but the script never executes at the scheduled time.

Root Cause

Common causes: wrong cron syntax, script not executable, PATH is different in cron environment (no /usr/local/bin etc.), or output silently failing because cron has no mail configured.

How to Fix
  1. Verify cron syntax at crontab.guru — paste your expression
  2. Make script executable: `chmod +x /path/to/script.sh`
  3. Redirect output to a log to capture errors: `* * * * * /path/script.sh >> /tmp/cron.log 2>&1`
  4. Use absolute paths inside the script — cron has a minimal PATH
  5. Check cron logs: `grep CRON /var/log/syslog | tail -20`
  6. Test the script manually as the cron user: `sudo -u www-data /path/script.sh`