blob: ddb2cb96d7c6c6c7e90480fbcf7281cf21eb983f [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"
Masayoshi Kobayashicf909f92013-06-21 13:28:22 -070011 cp $ZK_CONF $ZKDIR/conf
12 $ZK_DIR/bin/zkServer.sh start
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -070013}
14
15function stop {
16 # Kill the existing processes
17 pids=`jps -l | grep org.apache.zookeeper.server | awk '{print $1}'`
18 for p in ${pids}; do
19 if [ x$p != "x" ]; then
20 kill -KILL $p
21 echo "Killed existing prosess (pid: $p)"
22 fi
23 done
24}
25function status {
26 $ZK_DIR/bin/zkServer.sh status $ZK_CONF
27}
28
29case "$1" in
30 start)
31 start
32 ;;
33 stop)
34 stop
35 ;;
36 status)
37 status
38 ;;
39 restart)
40 stop
41 start
42 ;;
43 *)
44 echo "Usage: $0 {start|stop|restart|status}"
45 exit 1
46esac