Back to troubleshooting
Cron troubleshooting
cron
environment variables
path
linux cron

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 PATH entries.
  • 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.

Related cron resources

Blog
Troubleshooting
Why Cron Jobs Fail

A practical breakdown of the most common cron failure modes: environment, permissions, paths, timing, and monitoring.

Open
Blog
Troubleshooting
Cron Debugging Guide

Debug cron expressions, environment issues, path problems, permissions, logs, timezones, and overlapping runs.

Open
Blog
Monitoring
Cron Logging Guide

Capture cron output, structure logs, rotate files, and make scheduled job failures debuggable.

Open