#!/bin/bash
Supervisor=`ps -ef |grep -w Supervisor|grep -v grep|wc -l`
if [ $Supervisor -le 0 ];then
echo "Supervisor is not run"
else
echo "Supervisor is running.."
kill -9 $(ps -ef | grep Supervisor | grep -v grep | awk '{print $2}')
fi
UIServer=`ps -ef |grep -w UIServer|grep -v grep|wc -l`
if [ $UIServer -le 0 ];then
echo "UIServer is not run"
else
echo "UIServer is running.."
kill -9 $(ps -ef | grep UIServer | grep -v grep | awk '{print $2}')
fi
Nimbus=`ps -ef |grep -w Nimbus|grep -v grep|wc -l`
if [ $Nimbus -le 0 ];then
echo "Nimbus is not run"
else
echo "Nimbus is running.."
kill -9 $(ps -ef | grep UIServer | grep -v grep | awk '{print $2}')
fi
nohup ./bin/storm nimbus >/opt/storm/log/nimbus.log 2>&1 &
nohup ./bin/storm supervisor >/opt/storm/log/supervisor.log 2>&1 &
nohup ./bin/storm ui >/opt/storm/log/ui.log 2>&1 &
echo "OK"
================================================================
#杀死 进程名
kill -9 $(ps -ef | grep Supervisor | grep -v grep | awk '{print $2}')
kill -9 $(ps -ef | grep UIServer | grep -v grep | awk '{print $2}')
kill -9 $(ps -ef | grep Nimbus | grep -v grep | awk '{print $2}')
#nohup启动该服务命令,并存储在相应的log中,2>&1 &表示不生成nohup.out文件
nohup ./bin/storm nimbus >/opt/storm/log/nimbus.log 2>&1 &
nohup ./bin/storm supervisor >/opt/storm/log/supervisor.log 2>&1 &
nohup ./bin/storm ui >/opt/storm/log/ui.log 2>&1 &
#输出成功标识
echo "OK "