Hello,
I have installed my application to a path, let's say /usr/myapp and defined an environment variable in /etc/bashrc so that everyone knows where myapp is installed to.
Code:
export MYAPP_HOME=/usr/myapp
As long as my pals login interactively, everything looks good. Yet when it comes to scheduled jobs in the crontab, the /etc/bashrc doesn't get sourced and therefore no such variable defined.
At first my solution was to include the line at the top of the `crontab -e` as:
Code:
MYAPP_HOME=/usr/myapp
0 18 * * 1-5 sh $MYAPP_HOME/scripts/some-script
It worked, but it didn't seem right to do so because any further modification of the variable in /etc/bashrc would not be effective in the user's cron job list, which was difficult to maintain and created confusion.
I wonder if there is any way to make an environment variable globally effective in any login or any user's cron job. e.g. like $TOMCAT_HOME.
Any ideas? Thanks.
J.