Masaoyshi Kobayashi | e0698b2 | 2013-06-21 01:37:09 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Naoki Shiota | 4e46318 | 2014-03-21 15:13:24 -0700 | [diff] [blame] | 2 | |
| 3 | echo |
| 4 | echo "==================================================================" |
| 5 | echo "[WARNING] This script is deprecated. Use \"\$ ./onos.sh zk\" instead." |
| 6 | echo "==================================================================" |
| 7 | echo |
| 8 | |
Masaoyshi Kobayashi | e0698b2 | 2013-06-21 01:37:09 -0700 | [diff] [blame] | 9 | # Set paths |
| 10 | |
| 11 | ONOS_HOME=`dirname $0` |
| 12 | ZK_DIR=${HOME}/zookeeper-3.4.5 |
Masayoshi Kobayashi | 9973090 | 2013-06-27 23:23:20 -0700 | [diff] [blame] | 13 | #ZK_CONF=${ONOS_HOME}/conf/zoo.cfg |
Yuta HIGUCHI | a7ec073 | 2014-03-10 16:01:06 -0700 | [diff] [blame] | 14 | ZOO_LOG_DIR=${ONOS_HOME}/onos-logs |
Masaoyshi Kobayashi | e0698b2 | 2013-06-21 01:37:09 -0700 | [diff] [blame] | 15 | |
| 16 | function start { |
| 17 | # Run Zookeeper with our configuration |
| 18 | echo "Starting Zookeeper" |
Masayoshi Kobayashi | 9973090 | 2013-06-27 23:23:20 -0700 | [diff] [blame] | 19 | # echo "[31;48m[WARNING] This script copies conf/zoo.cfg to $ZK_DIR/conf/zoo.cfg (overwrites)[0m" |
| 20 | # echo "[31;48moriginal zoo.cfg was backed up as zoo.cfg.backup[0m" |
| 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 Kobayashi | cf909f9 | 2013-06-21 13:28:22 -0700 | [diff] [blame] | 27 | $ZK_DIR/bin/zkServer.sh start |
Masaoyshi Kobayashi | e0698b2 | 2013-06-21 01:37:09 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | function 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 | } |
| 40 | function status { |
Masayoshi Kobayashi | 9973090 | 2013-06-27 23:23:20 -0700 | [diff] [blame] | 41 | $ZK_DIR/bin/zkServer.sh status |
Masaoyshi Kobayashi | e0698b2 | 2013-06-21 01:37:09 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | case "$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 |
| 61 | esac |