记一次路由无缘丢失的检查脚本,如果丢失曾立即添加,
#!/bin/bash
#readme
#检查路由是否存在,如果存在则继续,否则增加一条路由
##后台执行语句: nohup /bin/bash /home/check_route.sh &
while true
do
count_num=`route -n |grep 192.xxx.xxx.xxx |wc -l`
# echo $count_num
if [ $count_num -lt 1 ]; then
route add -net 0/0 gw 192.xxx.xxx.xxx
Date=`date "+%Y-%m-%d %H:%M:%S"`
echo the route 不存在,the time is: $Date >> route_add.txt
else
# echo "the route is 存在" >> route_add.txt
continue
fi
sleep 1
done