Linux Cron Job Errors — Not Running, Permission Denied & Environment Issues
Warningsystem
Overview
Fix Linux cron job errors including jobs not running, permission denied, missing environment variables, PATH issues, and email notification failures.
Key Details
- Cron jobs run with a minimal environment — PATH, HOME, and SHELL may differ from your interactive session
- Default cron PATH is typically /usr/bin:/bin — commands in /usr/local/bin may not be found
- Cron output (stdout/stderr) is emailed to the user by default if no redirect is specified
- Crontab syntax: minute hour day month weekday command
- System cron jobs go in /etc/crontab or /etc/cron.d/ with an extra username field
Common Causes
- Command not found: cron PATH does not include the command's location
- Permission denied: script not executable or user not allowed to run cron
- Environment variables missing: cron does not source .bashrc or .profile
- Syntax error in crontab: wrong field format or missing fields
- Cron daemon not running (especially in containers)
Steps
- 1Check cron is running: systemctl status cron (or crond on RHEL)
- 2Use full paths in crontab: /usr/local/bin/python3 instead of just python3
- 3Set PATH at the top of crontab: PATH=/usr/local/bin:/usr/bin:/bin
- 4Redirect output to log: * * * * * /path/to/script.sh >> /var/log/myjob.log 2>&1
- 5Make scripts executable: chmod +x /path/to/script.sh and add #!/bin/bash shebang
Tags
linuxcronscheduled-taskenvironmenttroubleshooting
More in System
windows-C000021A-status-system-process-terminatedWindows Error 0xC000021A — STATUS SYSTEM PROCESS TERMINATED
Criticalwindows-C0000225-boot-configuration-errorWindows Error 0xC0000225 — Boot Configuration Error
Criticalwindows-C000000F-boot-selection-failedWindows Error 0xC000000F — Boot Selection Failed
Criticalwindows-80004005-unspecified-errorWindows Error 0x80004005 — Unspecified Error
Warningwindows-80070570-file-or-directory-corruptedWindows Error 0x80070570 — File or Directory Corrupted
Errorwindows-system-0xc0000185Windows Error 0xC0000185 — Boot Device Inaccessible
CriticalFrequently Asked Questions
Cron runs with a minimal environment. Your interactive shell has a full PATH and environment variables that cron does not. Use full paths and set env vars in the crontab.