|
|

楼主 |
发表于 2008-1-12 23:00:39
|
显示全部楼层
- #! /bin/sh
- ping -w 5 -I eth1 -n xx.xx.xx.xx > NUL
- if [ $? -ne 0 ]
- then
- my_ip=`/sbin/ifconfig eth1 | awk '/inet addr/{print $2}' | cut -d: -f2`
- date >> /var/log/eth1down.log
- /etc/init.d/net.eth1 restart
- new_ip=`/sbin/ifconfig eth1 | awk '/inet addr/{print $2}' | cut -d: -f2`
- echo $my_ip - $new_ip >> /var/log/eth1down.log
- echo >> /var/log/eth1down.log
- fi
- touch /var/log/eth1down.log
复制代码
自己解决. 谢谢.
也可以 if ping
else /etc/init.d/net.xxx restart
fi
对吧?
有没有当/var/log/eth1down.log超过128k后清空之的方法? |
|