File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ PIDFILE=/var/run/zkui.pid
4+ ZKUIBINDIR=$( cd ` dirname $0 ` ; pwd)
5+ ZKUICLASSNAME=" zkui-2.0-SNAPSHOT-jar-with-dependencies.jar"
6+ ZKUI_DAEMON_OUT=$ZKUIBINDIR /zkui.out
7+
8+ start (){
9+ echo -n " Starting zkui ... "
10+ if [ -f " $PIDFILE " ]; then
11+ if kill -0 ` cat " $PIDFILE " ` > /dev/null 2>&1 ; then
12+ echo zkui already running as process ` cat " $PIDFILE " ` .
13+ exit 0
14+ fi
15+ fi
16+ nohup java -jar " $ZKUIBINDIR /$ZKUICLASSNAME " > " $ZKUI_DAEMON_OUT " 2>&1 < /dev/null &
17+ if [ $? -eq 0 ];
18+ then
19+ echo $! > $PIDFILE
20+ if [ $? -eq 0 ];
21+ then
22+ sleep 1
23+ echo STARTED
24+ else
25+ echo FAILED TO WRITE PID
26+ exit 1
27+ fi
28+ else
29+ echo SERVER DID NOT START
30+ exit 1
31+ fi
32+ }
33+
34+ stop (){
35+ echo -n " Stopping zkui ... "
36+ if [ ! -f " $PIDFILE " ]
37+ then
38+ echo " no zkui to stop (could not find file $PIDFILE )"
39+ else
40+ kill -9 $( cat " $PIDFILE " )
41+ rm " $PIDFILE "
42+ echo STOPPED
43+ fi
44+ exit 0
45+ }
46+
47+ case " $1 " in
48+ start)
49+ start
50+ ;;
51+ stop)
52+ stop
53+ ;;
54+ restart)
55+ shift
56+ " $0 " stop
57+ sleep 3
58+ " $0 " start
59+ ;;
60+ * )
61+ echo " Usage: $0 {start|stop|restart}" >&2
62+ esac
You can’t perform that action at this time.
0 commit comments