while
[ 1 ]do
tun0_route=`ip route |
grep
-ci
"192.168.45.0"
`
if
[ $tun0_route -
eq
0 ];
then
route add -net 192.168.45.0/24 gw 192.168.61.253
echo -e `date '+%Y-%m-%d %H:%M:%S %A'` " 路由存在,休息60S!!" >> /tmp/tun0_route.log
sleep
60done |
#删除路由
#route add -net 192.168.45.0/24 gw 192.168.61.253
并加入开机启动 :
vi /etc/rc.local
chmod +x /etc/rc.local
sh
/home/tun0_route_monitor
.sh & >
/dev/null
2>&1 |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25469263/viewspace-2902614/ ,如需转载,请注明出处,否则将追究法律责任。