Skip to content

Instantly share code, notes, and snippets.

@ricbra
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricbra/e25dae0e13e500816d5c to your computer and use it in GitHub Desktop.
Save ricbra/e25dae0e13e500816d5c to your computer and use it in GitHub Desktop.
Startup script for Selenium
### BEGIN INIT INFO
# Provides: selenium
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: selenium
# Description: selenium with xvfb
### END INIT INFO
XVFB=/usr/bin/xvfb-run
XVFBARGS="java -jar /opt/selenium/selenium.jar"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
echo -n "Stopping virtual X frame buffer: Xvfb"
# does not work with start-stop-daemon because of child processes
read pid <$PIDFILE
pkill -TERM -P $pid
echo "."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/selenium {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment