Last active
August 29, 2015 14:08
-
-
Save ricbra/e25dae0e13e500816d5c to your computer and use it in GitHub Desktop.
Startup script for Selenium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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