Skip to content

Instantly share code, notes, and snippets.

@jeffery
Forked from robinhoode/selenium
Created July 6, 2011 22:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffery/1068531 to your computer and use it in GitHub Desktop.
Save jeffery/1068531 to your computer and use it in GitHub Desktop.
/etc/init.d/selenium
#!/bin/bash
# TODO: http://wiki.debian.org/LSBInitScripts
DESC="Selenium server"
RUN_AS=root
JAVA_BIN=/usr/bin/java
SELENIUM_DIR=/etc/selenium
PID_FILE="$SELENIUM_DIR/selenium.pid"
JAR_FILE="$SELENIUM_DIR/selenium-server-standalone-2.0b3.jar"
LOG_FILE="$SELENIUM_DIR/selenium.log"
MAX_MEMORY="-Xmx500m"
STACK_SIZE="-Xss1024k"
DAEMON_OPTS=" -client $MAX_MEMORY $STACK_SIZE -jar $JAR_FILE -log $LOG_FILE"
NAME=selenium
# TODO: Put together /etc/init.d/xvfb
export DISPLAY=:99.0
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $JAVA_BIN -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --pidfile $PID_FILE
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --pidfile $PID_FILE
sleep 1
start-stop-daemon -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $JAVA_BIN -- $DAEMON_OPTS
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment