检测网站down掉后自动发信的shell脚本代码
(编辑:jimmy 日期: 2024/11/15 浏览:3 次 )
复制代码 代码如下:
#!/bin/bash
#website test scripts
while true;do
for cycle_temp in `cat url_list`
do
if lynx -dump `echo ${cycle_temp}` -accept_all_cookies|grep "true";then
echo "The website is running naturally"
else
echo "${cycle_temp} has been offline please attend it now!">/opt/test.txt
mail -v -s "website down mail" reterry123@163.com < /opt/test.txt
fi
done
sleep 2s
done
#!/bin/bash
#website test scripts
while true;do
for cycle_temp in `cat url_list`
do
if lynx -dump `echo ${cycle_temp}` -accept_all_cookies|grep "true";then
echo "The website is running naturally"
else
echo "${cycle_temp} has been offline please attend it now!">/opt/test.txt
mail -v -s "website down mail" reterry123@163.com < /opt/test.txt
fi
done
sleep 2s
done
下一篇:linux shell 中 2>&1的含义