Possible Duplicate:
Reasons why crontab does not work
I'm migrating some scripts from an older machine to a lucid ec2 machine.
I'm sourcing a file in our ~/.bashrc
and setting some environment variables, but those variables don't seem to be accessible from any cron.
Even though my cron has a . /home/username/.bashrc && /path/to/script
the script doesn't seem to know of any of the environment variables which is in another file and sourced in ~/.bashrc
.
All of these scripts work successfully when I run them from the command line. While trying to run it from a crontab, however, they fail.
Each line in your cron will be executed by a separate process. Perhaps you should run them inside a subshell?
* * * * * root (. /home/nigel/.bashrc && script)
.Also, your .bashrc will usually have assumptions about it being a login shell (certain variables are assumed and their absence might make the script crash). For example, your .bashrc might start with this line, which means that nothing from your .bashrc will take effect when run from cron:
You might want to try with a small script that just has variable settings.