LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08: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, 01: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:23 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
Open Source Consulting | Domain Registration