LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-16-2011, 03:24 PM   #1
laredotornado
Member
 
Registered: Apr 2011
Posts: 71

Rep: Reputation: 0
How do I turn off a display?


Hi,

I am running a service (Selenium) that relies on launching browsers, even when there is not an active display. So in my startup script, I have

Code:
start() {
        log_daemon_msg "Starting selenium-server server: "
        /usr/bin/Xvfb :15 -ac -screen 0 1024x768x8 &
        export DISPLAY=localhost:15.0
        su selenium -c 'java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > /var/log/se_rc_server.log 2>&1 &'
What is the equivalent code I should put in the shutdown method? In other words, to de-activate the display? Right now, if I restart, I get the errors ...

Code:
selenium@selenium-chi:~$ sudo /etc/init.d/selenium-server start
 * Starting selenium-server server:                                                                                                                                        
Fatal server error:
Server is already active for display 15
        If this server is no longer running, remove /tmp/.X15-lock
        and start again.
Thanks, - Dave
 
Old 05-16-2011, 04:15 PM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Dunno if it'll work but what about a
Code:
rm /tmp/.X15-lock
 
Old 05-17-2011, 03:12 PM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by laredotornado View Post
Hi,

I am running a service (Selenium) that relies on launching browsers, even when there is not an active display. So in my startup script, I have

Code:
start() {
        log_daemon_msg "Starting selenium-server server: "
        /usr/bin/Xvfb :15 -ac -screen 0 1024x768x8 &
        export DISPLAY=localhost:15.0
        su selenium -c 'java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > /var/log/se_rc_server.log 2>&1 &'
What is the equivalent code I should put in the shutdown method? In other words, to de-activate the display? Right now, if I restart, I get the errors ...

Code:
selenium@selenium-chi:~$ sudo /etc/init.d/selenium-server start
 * Starting selenium-server server:                                                                                                                                        
Fatal server error:
Server is already active for display 15
        If this server is no longer running, remove /tmp/.X15-lock
        and start again.
Thanks, - Dave
You stop() function should kill all progerams started by start() i.e
/usr/bin/Xvfb and java.

Error message appears because you trying to run Xvfb on the same (:15) display, were it already running
 
Old 05-18-2011, 09:39 AM   #4
laredotornado
Member
 
Registered: Apr 2011
Posts: 71

Original Poster
Rep: Reputation: 0
Thanks for this, although I'm having some problems recording the process IDs. What is the correct way to get the process IDs after kicking off the jobs? I tried ...

Code:
        /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 &
        XVFB_PID=$!
        echo $XVFB_PID > /var/run/xvfb.pid
        su selenium -c 'java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > /var/log/se_rc_server.log 2>&1 &'
        PID=$!
        ### Create the lock file ###
        echo $PID > /var/run/selenium-server.pid
but both PIDs getting recorded to the files are the same. - Dave
 
Old 05-19-2011, 02:06 PM   #5
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by laredotornado View Post
Thanks for this, although I'm having some problems recording the process IDs. What is the correct way to get the process IDs after kicking off the jobs? I tried ...

Code:
        /usr/bin/Xvfb :15 -ac -screen 0 1024x768x16 &
        XVFB_PID=$!
        echo $XVFB_PID > /var/run/xvfb.pid
        su selenium -c 'java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js > /var/log/se_rc_server.log 2>&1 &'
        PID=$!
        ### Create the lock file ###
        echo $PID > /var/run/selenium-server.pid
but both PIDs getting recorded to the files are the same. - Dave
What you done looks OK. You can add 'set -x' in the beginning of you start function, so we be able to see what going on
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] OpenSUSE 11.1 x86_64 Can't Turn Off Display Power Management DarkWolf113440 Linux - Newbie 2 08-01-2009 04:47 AM
The screen isn't turn on after stand by when openning the laptop display nadavvin Linux - Laptop and Netbook 1 11-18-2007 11:46 PM
Turn Display Off in Command-Line frzburn Linux - Laptop and Netbook 5 01-24-2007 03:14 PM
How to turn X Display 90 degree kstan Linux - Hardware 2 10-06-2004 03:30 AM
When starting of linux RD 9 my display turn off Vitonux Red Hat 4 08-06-2004 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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