LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Closed Thread
 
Search this Thread
Old 07-10-2006, 09: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, 09:54 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Lubuntu
Posts: 19,176
Blog Entries: 4

Rep: Reputation: 430Reputation: 430Reputation: 430Reputation: 430Reputation: 430
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
 
Old 07-10-2006, 10:16 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,469
Blog Entries: 54

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
This one's closed.
 
  


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 - General 1 07-10-2006 09:55 AM
Scripts & Environment Variables geeman2.0 Linux - General 12 07-05-2005 05:10 PM
Why can't my scripts set environment variables? Matthew3 Linux - Software 5 08-28-2004 05:26 PM
Need help setting right environment variables:configure scripts can't find libraries. z-vet Linux - Newbie 4 08-16-2004 05:10 PM
Environment Variables in Scripts louisb Linux - General 3 01-15-2004 04:56 PM


All times are GMT -5. The time now is 12:44 AM.

Main Menu
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