blob: 36d531f9ce88f3e013b1e69421aadd565c6b302c [file] [log] [blame]
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -07001#!/bin/bash
Naoki Shiota4e463182014-03-21 15:13:24 -07002
3echo
4echo "=================================================================="
5echo "[WARNING] This script is deprecated. Use \"\$ ./onos.sh zk\" instead."
6echo "=================================================================="
7echo
8
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -07009# Set paths
10
11ONOS_HOME=`dirname $0`
12ZK_DIR=${HOME}/zookeeper-3.4.5
Masayoshi Kobayashi99730902013-06-27 23:23:20 -070013#ZK_CONF=${ONOS_HOME}/conf/zoo.cfg
Yuta HIGUCHIa7ec0732014-03-10 16:01:06 -070014ZOO_LOG_DIR=${ONOS_HOME}/onos-logs
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -070015
16function start {
17 # Run Zookeeper with our configuration
18 echo "Starting Zookeeper"
Masayoshi Kobayashi99730902013-06-27 23:23:20 -070019# echo "[WARNING] This script copies conf/zoo.cfg to $ZK_DIR/conf/zoo.cfg (overwrites)"
20# echo "original zoo.cfg was backed up as zoo.cfg.backup"
21# if [ $ZK_DIR/conf/zoo.cfg ]; then
22# cp $ZK_DIR/conf/zoo.cfg $ZK_DIR/conf/zoo.cfg.backup
23# fi
24# hostid > /var/lib/zookeeper/myid
25# cp $ZK_CONF $ZK_DIR/conf
26# echo "cp $ZK_CONF $ZK_DIR/conf"
Masayoshi Kobayashicf909f92013-06-21 13:28:22 -070027 $ZK_DIR/bin/zkServer.sh start
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -070028}
29
30function stop {
31 # Kill the existing processes
32 pids=`jps -l | grep org.apache.zookeeper.server | awk '{print $1}'`
33 for p in ${pids}; do
34 if [ x$p != "x" ]; then
35 kill -KILL $p
36 echo "Killed existing prosess (pid: $p)"
37 fi
38 done
39}
40function status {
Masayoshi Kobayashi99730902013-06-27 23:23:20 -070041 $ZK_DIR/bin/zkServer.sh status
Masaoyshi Kobayashie0698b22013-06-21 01:37:09 -070042}
43
44case "$1" in
45 start)
46 start
47 ;;
48 stop)
49 stop
50 ;;
51 status)
52 status
53 ;;
54 restart)
55 stop
56 start
57 ;;
58 *)
59 echo "Usage: $0 {start|stop|restart|status}"
60 exit 1
61esac