A common error for configuring cron
is to use environmental variables for an account in the cron command. However, cron will run the commands without these variables defined.
In the crontab -e
, adding . $HOME/.profile
before the commands play the trick. For example:
0 */8 * * * . $HOME/.profile; ~/bin/my-command
Cron is started by the system with a minimal environment. Hence, you need to add all other things that you need in your script.