|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。
0 i( w c) r- I6 C8 H7 |#!/bin/bash0 X3 M7 O& V2 \1 X
dt=`date '+%d/%m/%Y %H:%M:%S'`
0 w2 @% Z K6 ~ Psleep 60; \0 y9 Q4 ]' ` r) A
> /result.txt
1 e9 N1 x2 u+ H; Y _num=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "` D- [' _6 B. M# h. E
echo $num3 O4 m: ]/ t0 Q$ R
echo $?% r5 U- n7 R# o) v$ k
if [ $? -eq 0 -a $num -eq 0 ]; then
! K v1 I, ~5 C) ] echo "$dt ok" >> /result.txt8 x3 r. K |( F/ z1 _
else
" b! F4 V8 H- H! c3 ~$ X+ m, x echo "$dt noip loss $num reboot" >> /result.txt5 G7 ?) p, s: k3 X' c
reboot& V* R8 E4 x, @6 S; Y& F0 u1 ]! v! f
fi |
评分
-
查看全部评分
|