本帖最后由 syk 于 2016-1-14 18:22 编辑
其中Director的ip为192.168.10.3;RS1为192.168.10.7,RS2为192.168.10.8;RS提供apache服务,使用80端口。
{{{密码回复可见}}}
其中Director的ip为192.168.10.3;RS1为192.168.10.7,RS2为192.168.10.8;RS提供apache服务,使用80端口。
{{{密码回复可见}}}
0
#!/bin/bash
drip=192.168.10.3
rs1ip=192.168.10.7
rs2ip=192.168.10.8
while :
do
ping -c 4 $drip > /dev/null
if [ $? -ne 0 ]
then
echo "$drip is down" |mail -s "DR IS DOWN" aaa@bbb.com
fi
rs1=`echo -e "\n"|telnet $rs1ip 80|grep Connected`
if [ $? -ne 0 ]
then
echo "$rs1ip is down" |mail -s "RS1 IS DOWN" aaa@bbb.com
fi
rs2=`echo -e "\n"|telnet $rs2ip 80|grep Connected`
if [ $? -ne 0 ]
then
echo "$rs2ip is down" |mail -s "RS2 IS DOWN" aaa@bbb.com
fi
sleep 120
done
drip=192.168.10.3
rs1ip=192.168.10.7
rs2ip=192.168.10.8
while :
do
ping -c 4 $drip > /dev/null
if [ $? -ne 0 ]
then
echo "$drip is down" |mail -s "DR IS DOWN" aaa@bbb.com
fi
rs1=`echo -e "\n"|telnet $rs1ip 80|grep Connected`
if [ $? -ne 0 ]
then
echo "$rs1ip is down" |mail -s "RS1 IS DOWN" aaa@bbb.com
fi
rs2=`echo -e "\n"|telnet $rs2ip 80|grep Connected`
if [ $? -ne 0 ]
then
echo "$rs2ip is down" |mail -s "RS2 IS DOWN" aaa@bbb.com
fi
sleep 120
done
编辑回复