Created
May 27, 2011 18:44
-
-
Save robinhoode/995881 to your computer and use it in GitHub Desktop.
/etc/init.d/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
#!/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
Thought you might find this handy: https://gist.github.com/1064094