Accessing environment variables in startup scripts
Can somebody tell how the value of an environment variable can made available in startup script in Linux?
I have added JAVA_HOME=/usr/java/j2sdk1.4.2_10 in /etc/profile and a shell script testEnv in /etc/init.d/.
The script testEnv looks like this:
When I run script with command
it displays the values of JAVA_HOME which was set in /etc/profile.
But when the command
# service testEnv
is run it does not display any thing.
Can somebody tell why it doesn’t displays anything OR
Where should we define JAVA_HOME so that it should be visible to startup scripts OR
How the script should be modified so that it displays the value of JAVA_HOME set in /etc/profile or somewhere, when script executed at boot level ?