LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 02-06-2013, 09:02 AM   #1
hogar.strashni
Member
 
Registered: Dec 2007
Distribution: cp6
Posts: 44

Rep: Reputation: 2
Variable not accessible when service is starting


Hello everybody.

First, I'll generalize my problem. I have a file in /etc/profile.d/ directory that exports variable DISPLAY, and a services that demands variable DISPLAY in order to get started. Though DISPLAY variable is present, service script cannot access it during execution. Why?

I'm using CentOS 6.3

------------------------------------------------------------------------------------------------------------------------

To elaborate the problem: I'm trying to run Sahi and Selenium as daemons that outputs to Xvfb, and though I exported DISPLAY during startup, both Selenium and Sahi cannot see it when starting. On the other hand ,everything works fine if I put DISPLAY variable within service(Sahi or Selenium) starting script.

Finally, code look like this:
/etc/profile.d/xvfb.sh
Code:
export DISPLAY=:99
echo $DISPLAY returns :99

Relevant part of service starting script when service doesn't work: /etc/init.d/sahid.sh
Code:
./start_dashboard.sh
Relevant part of service starting script when service DOES work: /etc/init.d/sahid.sh
Code:
DISPLAY=":99" ./start_dashboard.sh
All that means that it can't access variable DISPLAY Again - why?

Hope I didn't miss the forum for the problem I have.
 
Old 02-06-2013, 02:17 PM   #2
slinx
Member
 
Registered: Apr 2008
Location: Cleveland, Ohio
Distribution: SuSE, CentOS, Fedora, Ubuntu
Posts: 106

Rep: Reputation: 23
Each service is started in its own subshell, with its own environment variables. They are non-interactive shells, so they do not source the system-wide profiles. You must place any variable definitions within that service's init script or configuration file.
 
1 members found this post helpful.
  


Reply

Tags
init script, profile, script, service, variables


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
starting this as a service. dkc_ace Linux - General 15 12-27-2004 10:31 PM
Won't Boot - Starting Printer Service - Starting CUPS jeansond Linux - Newbie 0 10-11-2004 07:39 PM
No net-based service accessible rytrom Linux - Newbie 3 11-20-2003 01:46 PM
starting one service before the other in Rh jayakrishnan Linux - General 2 11-19-2003 01:32 AM
starting up a service Robin01 Linux - Newbie 3 08-31-2003 06:04 AM


All times are GMT -5. The time now is 02:05 PM.

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