因公司要求,在网站挂了之后,需要播放声音,让大家能立刻知道,假如不在公司可以发邮件给大家,假如相关人员不能上网,可以发短信给大家,达到及时通知的目的。
#!/bin/bash
#website test scripts
while true;do
for cycle_temp in `cat /opt/autotest/websit_url_links`
do
temp=1
i=1
character_sign_1=22
character_sign_2=11
while [ ${i} -lt $character_sign_1 ]
do
if lynx -dump `echo ${cycle_temp}` -accept_all_cookies|grep "true"
then
let "temp=$temp+0"
else
let "temp=$temp+1"
fi
let "i=${i}+1"
echo ${i}
echo ${temp}
sleep 5s
done
if [ ${temp} -gt $character_sign_2 ]
then
echo "${cycle_temp} has been down"
echo "${cycle_temp} has been offline,please attend it now!">/opt/autotest/test.txt
mail -s "website down mail" [email]ps_autotest@bizcom.com.cn[/email]</opt/autotest/test.txt
mplayer /opt/autotest/love.mp3
for read_phone in `cat /opt/autotest/PS_MobilePone.txt`
do
echo "sms `echo $read_phone` '`echo $cycle_temp` has been offline,please attend it now!'" >> /opt/autotest/sendmessage.txt
done
echo "exit" >>/opt/autotest/sendmessage.txt
/opt/fetion/install/fetion -u 13521186114 -p 111111 -b /opt/autotest/sendmessage.txt
fi
rm -rf /opt/autotest/sendmessage.txt
done
sleep 10m
done
需要解释的话给我发邮件[email]guoli0813@163.com[/email]。
#!/bin/bash
#website test scripts
while true;do
for cycle_temp in `cat /opt/autotest/websit_url_links`
do
temp=1
i=1
character_sign_1=22
character_sign_2=11
while [ ${i} -lt $character_sign_1 ]
do
if lynx -dump `echo ${cycle_temp}` -accept_all_cookies|grep "true"
then
let "temp=$temp+0"
else
let "temp=$temp+1"
fi
let "i=${i}+1"
echo ${i}
echo ${temp}
sleep 5s
done
if [ ${temp} -gt $character_sign_2 ]
then
echo "${cycle_temp} has been down"
echo "${cycle_temp} has been offline,please attend it now!">/opt/autotest/test.txt
mail -s "website down mail" [email]ps_autotest@bizcom.com.cn[/email]</opt/autotest/test.txt
mplayer /opt/autotest/love.mp3
for read_phone in `cat /opt/autotest/PS_MobilePone.txt`
do
echo "sms `echo $read_phone` '`echo $cycle_temp` has been offline,please attend it now!'" >> /opt/autotest/sendmessage.txt
done
echo "exit" >>/opt/autotest/sendmessage.txt
/opt/fetion/install/fetion -u 13521186114 -p 111111 -b /opt/autotest/sendmessage.txt
fi
rm -rf /opt/autotest/sendmessage.txt
done
sleep 10m
done
需要解释的话给我发邮件[email]guoli0813@163.com[/email]。
转载于:https://blog.51cto.com/guoli0813/127681