OpenWRT偶尔会自动死机或断线,手动检测重店比较麻烦,下面就用一个脚本来自动判断路由器是否连网。

#!/bin/sh
# 自动检查线路是否正常,不正常就重启 Openwrt 重新拨号

PING=`ping -c 5 202.96.128.86|grep -v grep|grep '64 bytes' |wc -l`
if [ ${PING} -ne 0 ];then
    exit 0
else
    /etc/init.d/network restart
fi
sleep 10

PING2=`ping -c 5 202.96.128.86|grep -v grep|grep '64 bytes' |wc -l`
if [ ${PING2} -ne 0 ];then
    exit 0
else
    reboot
fi

通过ping电信的dns服务器,来判断网络是否连通。如果不通,就重启网络。10秒后再次检测,如果还不通,就重启路由器。

https://kzpu.com/archives/4023.html

相关文章:

  • 2021-09-03
  • 2021-05-13
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2022-03-01
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案