Possible to run selenium server as a background process?

2,900 views
Skip to first unread message

laredotornado

unread,
Apr 27, 2011, 4:40:17 PM4/27/11
to Selenium Users
Hi,

I'm running Ubuntu 10, Java 1.6, and Selenium stand-alone remote
control server 2.0b3. I want to run my Selenium server as a background
process. I have this in a /etc/init.d startup script …

su selenium -c 'java -jar /opt/selenium/selenium-server-
standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js
&>/dev/null &'

where "selenium" is a user on my Linux system. I've noticed that
unless I'm logged in as the user "selenium", even when the process
runs, my commands always die with the error, "ERROR Server Exception:
sessionId should not be null; has this session been started yet?"

How can I run the selenium server in the background without having to
be logged in to the system? - Dave

AJ

unread,
Apr 28, 2011, 12:15:39 AM4/28/11
to Selenium Users
Is it possible to give this command directly in startup option? Under
System->Preference->Startup Applications?

laredotornado

unread,
Apr 28, 2011, 10:17:28 AM4/28/11
to Selenium Users
Hi,

Thanks for this suggestion. The skinny is it didn't work, but here's
what I did. I logged in as my user, "selenium". Set up the startup
program using Name=Selenium Server, Command=/etc/init.d/selenium-
server start (my script is below), added a comment and saved. I was
never prompted to enter a root/sudo password. I saved and restarted
but the process didn't run.

Hey, also, could you post a reply to the question I posed on the
google chrome thread? Thanks, and here's the script I'm using
(suggestions for improvements welcomed) - Dave


==============start script =====================
#!/bin/bash

# Start the service selenium-server
start() {
logger "Starting selenium-server server: "
export DISPLAY=:0
su selenium -c 'java -jar /opt/selenium/selenium-server-
standalone-2.0b3.jar -userExtensions /opt/selenium/user-extensions.js
&>/dev/null &'
PID=$!
### Create the lock file ###
echo $PID > /var/run/selenium-server.pid
success $"selenium-server server startup"
echo
}

# Restart the service selenium-server
stop() {
logger "Stopping selenium-server server: "
cat /var/run/selenium-server.pid | xargs kill -15
### Now, delete the PID file ###
rm -f /var/run/selenium-server.pid
echo
}

### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status selenium-server
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0
==============stop script =====================


On Apr 27, 11:15 pm, AJ <anand...@gmail.com> wrote:
> Is it possible to give this command directly in startup option? Under
> System->Preference->Startup Applications?
>

AJ

unread,
Apr 29, 2011, 2:18:34 AM4/29/11
to Selenium Users

In the startup application dialog box, enter this and save. When you
machine restarts, this will be executed. Run your selenium tests and
see if its working

java -jar /opt/selenium/selenium-server-standalone-2.0b3.jar -
userExtensions /opt/selenium/user-extensions.js


Reply all
Reply to author
Forward
0 new messages