-   Linux - Networking (
-   -   Accessing environment variables in startup scripts (

sanjeevkchopra 07-10-2006 09:44 AM

Accessing environment variables in startup scripts
Hi All,

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:

#! /bin/sh

When I run script with command
# /etc/init.d/testEnv
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 ?

Sanjeev Kumar.

acid_kewpie 07-10-2006 09:54 AM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

All times are GMT -5. The time now is 09:41 PM.