|
|
csky
发表于 2019-10-12 20:06:50
|
显示全部楼层
IP:–江苏–苏州 电信
老哥 我优化了下,丢包重启。。。
/ F( N1 ^4 j0 s, t+ b#!/bin/bash
3 T7 U2 r/ P8 tdt=`date '+%d/%m/%Y %H:%M:%S'`
) m4 M& [/ H# {3 S" Q8 R) Isleep 60
! d/ E6 i. h3 k8 R- n O# r> /result.txt
+ T1 M/ | d& f6 r( ^num=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
( ^4 [' b+ {; D) x; Lecho $num* n: H% a: c) _! L
echo $?
/ {$ O* x, B* ^* M8 g& P/ J: Kif [ $? -eq 0 -a $num -eq 0 ]; then
9 g* u8 P" V: Q" @ echo "$dt ok" >> /result.txt" W4 x- L N% @' r. Z
else/ B+ |# u5 n+ w& q" u; v% _
echo "$dt noip loss $num reboot" >> /result.txt5 ~) _6 e: B, y1 b R/ U
reboot' y E0 d+ F& y3 H/ i6 `) P
fi |
评分
-
查看全部评分
|