linux檢查網絡狀態腳本

1,通過定時收發email檢測網絡連通性
#/bin/bash echo "Daily test mail" > state.txt
mail -s Server_State [email protected] < state.txt
rm -df ./state.txt
1,通過定時收發email檢測網絡連通性
#/bin/bash
echo "Daily test mail" &gt; state.txt
mail -s Server_State abc@md1.21.co.jp < state.txt
rm -df ./state.txt
~
crontab -e
增加如下任務
10 07 * * * /root/checkNKmail &
分時日月周
2,定時檢測網絡狀態通過email發送
checkserverstat腳本內容:
#/bin/bash
echo "HZtelecomDNS" > state.txt
ping -c 5 202.101.172.35 >> state.txt
echo "
bJU" &gt;&gt; state.txt
ping -c 5 10.X.X.X >> state.txt
echo "ADSL Gateway" >>state.txt
ping -c 5 X.X.X.X >> state.txt
echo "Server_Outside ***" >>state.txt
ping -c 5 192.168.2.100 >>state.txt
echo "Server_Outside WAN" >> state.txt
ping -c 5 X.X.X.X >> state.txt
echo "*** in company" >> state.txt
ping -c 5 192.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
10 16 * * * /root/CheckWeatherState &
10 09 * * * /root/checkserverstate &
10 13 * * * /root/checkserverstate &
10 17 * * * /root/checkserverstate &
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章