LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Closed Thread
 
Search this Thread
Old 07-10-2006, 10:44 AM   #1
sanjeevkchopra
LQ Newbie
 
Registered: May 2006
Posts: 14

Rep: Reputation: 0
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
echo JAVA_HOME=$JAVA_HOME

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 ?

Regards,
Sanjeev Kumar.
 
Old 07-10-2006, 10:54 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
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.

http://www.linuxquestions.org/rules.php
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing environment variables in startup scripts sanjeevkchopra Linux - Security 2 07-10-2006 11:16 AM
Accessing environment variables in startup scripts sanjeevkchopra Linux - General 1 07-10-2006 10:55 AM
Scripts & Environment Variables geeman2.0 Linux - General 12 07-05-2005 06:10 PM
Why can't my scripts set environment variables? Matthew3 Linux - Software 5 08-28-2004 06:26 PM
Environment Variables in Scripts louisb Linux - General 3 01-15-2004 05:56 PM


All times are GMT -5. The time now is 05:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration