Keep in mind that a script running in cron does not have the same environment as a script running in shell.
The cron daemon starts a subshell from your HOME directory.
The cron daemon supplies a default environment for every shell, defining HOMEHOME
, LOGNAMELOGNAME
, SHELLSHELL
(=/usr/bin/sh/usr/bin/sh
),
and PATH and PATH
(=/usr/bin/usr/bin
).
Do not depend on environment variables. This includes path setting, x11 settings, or anything else.
Use full path, for example:
instead of symplysimply calling javajava
or pythonpython
you have to use /usr/bin/java/usr/bin/java
or /usr/bin/python/usr/bin/python
.