一、通过定时收发email检测网络连通性
#/bin/bash echo "Daily test mail" > state.txt mail -s Server_State abc@jb51.net < state.txt rm -df ./state.txt
~
crontab -e
增加如下任务
10 07 * * * /root/checkNKmail &
分时日月周
二、定时检测网络状态通过email发送
checkserverstat脚本内容:
#/bin/bash echo "HZtelecomDNS" > state.txt ping -c 5202.101.172.35 >> state.txt echo " bJU" >> state.txt ping -c 510.X.X.X >> state.txt echo "ADSL Gateway" >>state.txt ping -c 5 X.X.X.X >> state.txt echo "Server_Outside VPN" >>state.txt ping -c 5192.168.2.100 >>state.txt echo "Server_Outside WAN" >> state.txt ping -c 5 X.X.X.X >> state.txt echo "VPN in company" >> state.txt ping -c 5192.168.1.4 >>state.txt echo "L2tp at aaa Libweb" >>state.txt ping -c 5 X.X.X.X & >>state.txt mail -s Server_State admin@abc.com <state.txt rm -df ./state.txt
crontab中增加任务
corntab -e 1016 * * * /root/CheckWeatherState & 1009 * * * /root/checkserverstate & 1013 * * * /root/checkserverstate & 1017 * * * /root/checkserverstate &
原文:http://www.cnblogs.com/clarke/p/5499091.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!