Instantly share code, notes, and snippets.

Embed
What would you like to do?
/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
@jeffery

This comment has been minimized.

jeffery commented Jul 5, 2011

Thought you might find this handy: https://gist.github.com/1064094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment