The cronjob scripts are run in different environment than in command line, which causes a lot of trouble for cronjob developers. We list here the default environment for cronjob:
1 2 3 4 5 6 7 8 9 |
SHELL=/bin/sh USER=root PATH=/usr/bin:/bin _=/usr/bin/env PWD=/root LANG=en_US.UTF-8 HOME=/root SHLVL=2 LOGNAME=root |
You can see there are much fewer variables compared to command line environment. The important environment variable is PATH which is set to /usr/bin:/bin by default. If your cronjob script includes commands that are not in these paths, you should use absolute path in the script.