Created
April 30, 2010 18:15
-
-
Save emerleite/385572 to your computer and use it in GitHub Desktop.
This file contains 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 | |
### BEGIN INIT INFO | |
# Provides: Start Selenium server | |
# Author: Emerson Macedo - http://github.com/emerleite - http://codificando.com | |
# Description: Manage selenium server start and stop | |
### END INIT INFO | |
NAME="selenium" | |
PIDFILE="./selenium.pid" | |
LOGFILE="./selenium.log" | |
start_app() { | |
if [ -f $PIDFILE ] | |
then | |
echo "$NAME already started" | |
exit 1 | |
fi | |
java -jar selenium-server.jar > $LOGFILE & echo $! > $PIDFILE | |
} | |
stop_app() { | |
if [ ! -f $PIDFILE ] | |
then | |
echo "$NAME is not started" | |
exit 1 | |
fi | |
kill -9 `cat $PIDFILE` | |
rm -f $PIDFILE | |
} | |
case "$1" in | |
start) | |
echo "Startando $NAME " | |
start_app | |
echo "$NAME started" | |
;; | |
stop) | |
echo "Stopping $NAME" | |
stop_app | |
echo "$NAME stopped" | |
;; | |
restart|force-reload) | |
echo -n "Restarting $NAME" | |
stop_app | |
sleep 2 | |
start_command | |
echo "$NAME restarted" | |
;; | |
*) | |
echo "Usage: $NAME.sh {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment