linn

 

cd $(dirname $0)

source ~/.bash_profile

count_zoo=`ps -ef | grep "config/zookeeper.properties" | grep -v grep | wc -l`
count_kafka=`ps -ef | grep "config/server.properties" | grep -v grep | wc -l`
count_2181=`netstat -antp | grep ":2181" | grep -v grep | wc -l`
count_9092=`netstat -antp | grep ":9092" | grep -v grep | wc -l`

echo $count_zoo

if [ $count_zoo -eq 0 ] || [ $count_kafka -eq 0 ] || [ $count_2181 -eq 0 ] || [ $count_9092 -eq 0 ];then
    bin/kafka-server-stop.sh 
    bin/zookeeper-server-stop.sh
        nohup bin/zookeeper-server-start.sh config/zookeeper.properties&
    nohup bin/kafka-server-start.sh config/server.properties &
fi

 

cd $(dirname $0)


count=`ps -ef | grep "python watch_file_temp.py" | grep -v grep | wc -l`
count_9092=`netstat -antp | grep ":9092" | grep -v grep | wc -l`


if [ $count -eq 0 ] || [ $count_9092 -eq 0 ];then
   killall -9 watch_file_temp.py
   nohup /usr/bin/python watch_file_temp.py &
fi

 

ps -ef | grep kafka | awk \'{print $2}\' | xargs kill -9

分类:

技术点:

相关文章:

  • 2021-11-02
  • 2021-11-14
  • 2021-12-18
  • 2021-12-09
  • 2021-09-15
  • 2021-04-18
  • 2021-12-07
猜你喜欢
  • 2021-11-19
  • 2021-11-05
  • 2021-11-12
  • 2021-12-06
  • 2021-12-23
  • 2021-11-18
  • 2021-09-04
相关资源
相似解决方案