blob: 26db2fafdfc360549ba26ce687c5d5665415681c [file] [log] [blame]
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -07001#!/bin/bash
2# Set paths
3
4ONOS_HOME=`dirname $0`
5ZK_DIR=${HOME}/zookeeper-3.4.5
6ZK_CONF=${ONOS_HOME}/conf/zoo.cfg
7
8function start {
9 # Run Zookeeper with our configuration
10 echo "Starting Zookeeper"
11 $ZK_DIR/bin/zkServer.sh start $ZK_CONF
12}
13
14function stop {
15 # Kill the existing processes
16 pids=`jps -l | grep org.apache.zookeeper.server | awk '{print $1}'`
17 for p in ${pids}; do
18 if [ x$p != "x" ]; then
19 kill -KILL $p
20 echo "Killed existing prosess (pid: $p)"
21 fi
22 done
23}
24function status {
25 $ZK_DIR/bin/zkServer.sh status $ZK_CONF
26}
27
28case "$1" in
29 start)
30 start
31 ;;
32 stop)
33 stop
34 ;;
35 status)
36 status
37 ;;
38 restart)
39 stop
40 start
41 ;;
42 *)
43 echo "Usage: $0 {start|stop|restart|status}"
44 exit 1
45esac