-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzookeeper.sh
More file actions
49 lines (46 loc) · 1.19 KB
/
zookeeper.sh
File metadata and controls
49 lines (46 loc) · 1.19 KB
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
#!/bin/sh
#
# zookeeper Start/Stop zookeeper
#
# chkconfig: - 99 10
# description: Standard script to start and stop zookeeper
KAFKA_ROOT_PATH=
KAFKA_PATH=$KAFKA_ROOT_PATH/bin
ZOOKEEPER_PROCESS_NAME=zookeeper
PATH=$PATH:$KAFKA_PATH
# See how we were called.
case "$1" in
start)
# Start daemon.
pid=`ps ax | grep -i 'org.apache.zookeeper' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Zookeeper is already running";
else
echo "Starting $ZOOKEEPER_PROCESS_NAME";
$KAFKA_PATH/zookeeper-server-start.sh -daemon $KAFKA_ROOT_PATH/config/zookeeper.properties
fi
;;
stop)
echo "Shutting down $ZOOKEEPER_PROCESS_NAME";
$KAFKA_PATH/zookeeper-server-stop.sh
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
pid=`ps ax | grep -i 'org.apache.zookeeper' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Zookeeper is Running as PID: $pid"
else
echo "Zookeeper is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0