Cron Environment
· One min read
Cron often runs in an almost empty environment.
The default path is very minimal. Therefore you should either use absolute paths or explicitly set the PATH
variable when using binaries.
Solutions:
PATH=/bin:/usr/bin:/usr/local/bin
# or
5 4 * * sun /absolute/path/to/the/binary
If you decide to set the PATH
variable, you can’t append :$PATH
:
PATH="$HOME/bin:$PATH" # does not work