exec_tarbitrator.sh 1.2 KB
Newer Older
H
Hui Li 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/bin/sh

# if [ $# != 2 || $# != 3 ]; then 
  # echo "argument list need input : "
  # echo "  -s start/stop"
  # exit 1
# fi

EXEC_OPTON=
while getopts "n:s:u:x:ct" arg 
do
  case $arg in
    n)
      NODE_NAME=$OPTARG
      ;;
    s)
      EXEC_OPTON=$OPTARG
      ;;
    c)
      CLEAR_OPTION="clear"
      ;;
    t)
      SHELL_OPTION="true"
      ;;
    u)
      USERS=$OPTARG
      ;;
    x)
      SIGNAL=$OPTARG
      ;;
    ?)
      echo "unkown argument"
      ;;
  esac
done


SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../
SCRIPT_DIR=`pwd`

42 43 44 45 46 47 48
TDINTERNAL="TDinternal"
if [[ "$SCRIPT_DIR" == *"$TDINTERNAL"* ]]; then
  cd ../../..
else
  cd ../../
fi

H
Hui Li 已提交
49 50
TAOS_DIR=`pwd`

51 52 53 54
BIN_DIR=`find . -name "taosd"|grep bin| cut -d '/' --fields=2,3`

BUILD_DIR=$TAOS_DIR/$BIN_DIR

H
Hui Li 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68
SIM_DIR=$TAOS_DIR/sim
NODE_DIR=$SIM_DIR/arbitrator
EXE_DIR=$BUILD_DIR/bin
LOG_DIR=$NODE_DIR/log

echo "------------ $EXEC_OPTON tarbitrator"

if [ "$EXEC_OPTON" = "start" ]; then 
  echo "------------ log path: $LOG_DIR"
  nohup $EXE_DIR/tarbitrator -p 8000 -d 135 -g $LOG_DIR > /dev/null 2>&1 & 
else
  #relative path
  PID=`ps -ef|grep tarbitrator | grep -v grep | awk '{print $2}'`
  if [ -n "$PID" ]; then   
69 70
    kill -9 $PID
    pkill -9 tarbitrator
H
Hui Li 已提交
71 72 73
  fi 
fi