!/bin/bash
for host in node-1 node-2 node-3
do
ssh $host “source /etc/profile;”
ip=(ssh(sshhost ifconfig eth0|grep “inet addr:”|awk -F”:” ‘{print 2}'|awk '{print2}'|awk '{print1}’)
pid1=(ssh(sshhost ps ax | grep -i ‘core’ | grep java | grep -v grep | awk ‘{print 1}’)
pid2=1}’) pid2=(ssh hostpsax|grep−i‘nimbus′|grepjava|grep−vgrep|awk‘print$1′)pid3=hostpsax|grep−i‘nimbus′|grepjava|grep−vgrep|awk‘print$1′)pid3=(ssh host ps ax | grep -i ‘supervisor’ | grep java | grep -v grep | awk ‘{printhost ps ax | grep -i ‘supervisor’ | grep java | grep -v grep | awk ‘{print1}’)i
if [ -z “pid1”];thenecho“pid1”];thenecho“ip storm ui is not runnning”
else
ssh hostkill−9hostkill−9pid1
echo “$ip storm ui is stopping”
fi
if [ -z “pid2”];thenecho“pid2”];thenecho“ip storm nimbus is not runnning”
else
ssh hostkill−9hostkill−9pid2
echo “$ip storm nimbus is stopping”
fi
if [ -z “pid3”];thenecho“pid3”];thenecho“ip storm supervisor is not runnning”
else
ssh hostkill−9hostkill−9pid3
echo “$ip storm supervisor is stopping”
fi
done