校園路由器斷網重連

QQQ_發表於2020-10-27

1.路由器採用openwrt系統,執行校園網client。
2.通過ping取baidu.com網頁,返回丟幀情況,用pingtemp.txt記錄返回事件。

PING baidu.com (39.156.69.79): 56 data bytes
64 bytes from 39.156.69.79: seq=0 ttl=47 time=41.277 ms
64 bytes from 39.156.69.79: seq=1 ttl=47 time=39.020 ms
64 bytes from 39.156.69.79: seq=2 ttl=47 time=39.890 ms
64 bytes from 39.156.69.79: seq=3 ttl=47 time=39.707 ms
64 bytes from 39.156.69.79: seq=4 ttl=47 time=39.234 ms

--- baidu.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 39.020/39.825/41.277 ms

3.通過grep搜尋pingtemp.txt檔案丟幀100%的情況。
4.當發生100%丟幀情況後,定時任務啟用recall.sh重啟校園網客戶端。

100% packet loss
  if grep 100% /QQQtest/pingtemp.txt
  then
   echo find it
   date>>/QQQtest/resartlog.txt
   /etc/init.d/scutclient restart
  else
   echo can not find it
fi
* cket loss* * * 1-7 /QQQtest/log.sh;/QQQtest/cleanlog.sh
* 6-24 * * 1-5 /QQQtest/recall.sh
* * * * 6-7 /QQQtest/recall.sh

相關文章