Cron script runs manually but not in crontab
Debug cron scripts that work from the terminal but fail when executed by crontab.
Cron runs commands in a smaller environment than your interactive shell.
Common causes
- Missing
PATHentries. - Relative file paths.
- Missing environment variables.
- Different working directory.
- Script is not executable.
- Shell-specific syntax running under a different shell.
Fix pattern
Use absolute paths, set required environment variables explicitly, and redirect output to a log file while debugging.