Default environment for cron job

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:

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.

Posted in tips of hosting