解决openwrt 无线桥接经常断网shell脚本

多年前购买了一个不知道多少手的小米 R1C双频路由器,刷了openwrt系统,由于使用无线桥接上网经常断网,需要手动重启wan接口就恢复正常了,所以写了shell检测脚本。脚本如下:

status=` ping -s 1000 baidu.com -c 1 | grep 'from' | awk '{print $1}' `
if [ $status -eq 1008 ];then
        int=1
        while [ $int -lt 5 ]
        do
                delay=` ping -s 1000 baidu.com -c 1 | grep 'from' | awk '{print $7}' | awk -F'=' '{print $2}' `
                if [ $delay -gt 70 ];then
                        if [ $int -eq 4 ];then
                                sleep 30s
                                date >> /tmp/test_ping.log
                                /sbin/ifup wan
                        fi
                else
                        break
                fi
                let "int++"
                sleep 1s
        done
else
        sleep 30s
        date >> /tmp/test_ping.log
        /sbin/ifup wan
fi
Tags:

Add a Comment

您的电子邮箱地址不会被公开。 必填项已用*标注