Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10708421
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 10:58:51

1,通过定时收发email检测网络连通性
#/bin/bash
echo "Daily test mail" > state.txt
mail -s Server_State abc < 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" >> 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 VPN"  >>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 "VPN 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
rm -df ./state.txt
~                          
 
crontab中增加任务
corntab -e
10 16 * * * /root/CheckWeatherState &
10 09 * * * /root/checkserverstate &
10 13 * * * /root/checkserverstate &
10 17 * * * /root/checkserverstate &

本文出自 “寒.枫” 博客,转载请与作者联系!

阅读(1385) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~