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