Getting some jobs to run under
cron(1) can be confusing and difficult since cron executes tasks in the
crontab(5) file with a different underlying environment than a user normally runs in. What works from you login shell command line often won't from a cron job. Here is how to get it back.
What determines cron's environment?
cron runs with the barest environment. You can discover this by running the following in your
* * * * * (/usr/bin/date ; /usr/bin/env | /usr/bin/sort) >> /tmp/my_cron_env 2>&1
This will run the task every minute, with
stderr sent to the file. You should make sure to remove or comment out this line after a minute or so or you'll build up quite a long file.