!/bin/bash
for host in node-1 node-2 node-3
do
ssh $host “source /etc/profile;”
ip= (ssh ( s s h host ifconfig eth0|grep “inet addr:”|awk -F”:” ‘{print 2}'|awk '{print 2}'|awk '{print 1}’)
pid1=
(ssh
(
s
s
h
host 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=
h
o
s
t
p
s
a
x
|
g
r
e
p
−
i
‘
n
i
m
b
u
s
′
|
g
r
e
p
j
a
v
a
|
g
r
e
p
−
v
g
r
e
p
|
a
w
k
‘
p
r
i
n
t
$
1
′
)
p
i
d
3
=
(ssh host ps ax | grep -i ‘supervisor’ | grep java | grep -v grep | awk ‘{print
host ps ax | grep -i ‘supervisor’ | grep java | grep -v grep | awk ‘{print
1}’)i
if [ -z “
pid1”];thenecho“
p
i
d
1
”
]
;
t
h
e
n
e
c
h
o
“
ip storm ui is not runnning”
else
ssh
hostkill−9
h
o
s
t
k
i
l
l
−
9
pid1
echo “$ip storm ui is stopping”
fi
if [ -z “
pid2”];thenecho“
p
i
d
2
”
]
;
t
h
e
n
e
c
h
o
“
ip storm nimbus is not runnning”
else
ssh
hostkill−9
h
o
s
t
k
i
l
l
−
9
pid2
echo “$ip storm nimbus is stopping”
fi
if [ -z “
pid3”];thenecho“
p
i
d
3
”
]
;
t
h
e
n
e
c
h
o
“
ip storm supervisor is not runnning”
else
ssh
hostkill−9
h
o
s
t
k
i
l
l
−
9
pid3
echo “$ip storm supervisor is stopping”
fi
done