Cron Job Shell Scripts Failing

A common request in Linux forums is shell scripts working as expected from the command line yet failing in cron jobs.

Not well understood is cron jobs do not inherit a full environment. The solution is straightforward.

  • Use full paths for all commands.
  • Explicitly declare the PATH variable in the script for commands not located in the standard environment search path
  • Explicitly declare environment variables, such as the DISPLAY variable.
  • Ensure the correct environment exists. For example, running GUI apps or commands requires X running.

Posted: Category: Usability Tagged: General

Next: Odd MATE Menu Bug

Previous: The Year of the Linux Desktop