-
Notifications
You must be signed in to change notification settings - Fork 6
/
selenium
executable file
·57 lines (51 loc) · 1.14 KB
/
selenium
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
### BEGIN INIT INFO
# Adapted from code provided by
# 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="./var/log/selenium.log"
JARFILE="./parts/selenium/selenium-server.jar"
start_app() {
echo "Starting $NAME..."
if [ -f $PIDFILE ]
then
echo "$NAME is already running !"
else
java -jar $JARFILE >$LOGFILE 2>&1 & echo $! > $PIDFILE
echo "$NAME has started."
fi
}
stop_app() {
echo "Stopping $NAME..."
if [ ! -f $PIDFILE ]
then
echo "$NAME was not running !"
else
kill -9 `cat $PIDFILE`
rm -f $PIDFILE
echo "$NAME has been stopped."
fi
}
case "$1" in
start)
start_app
;;
stop)
stop_app
;;
restart|force-reload)
echo "Restarting $NAME..."
stop_app
sleep 2
start_app
echo "$NAME restarted."
;;
*)
echo "Usage: $NAME.sh {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0