|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。
7 ]" |8 M% x- K+ M! L# [3 O! I) V#!/bin/bash ?/ n) B0 V* I
dt=`date '+%d/%m/%Y %H:%M:%S'`
9 O+ a6 @- G9 Zsleep 60/ H, `2 ^5 ~* o2 q
> /result.txt
6 {8 j0 p& \0 z$ @1 G+ hnum=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
1 v0 r1 A. e5 Secho $num. m8 n7 E$ @- g4 i9 l2 Z3 t5 g
echo $?
: d# c" H1 H0 {0 s9 mif [ $? -eq 0 -a $num -eq 0 ]; then( D! u6 @" g) S# R5 z4 n/ ]
echo "$dt ok" >> /result.txt+ r" V3 x: ]7 f$ j9 ?& q, m
else* |$ t. g5 z8 ]! G, O( k
echo "$dt noip loss $num reboot" >> /result.txt
1 d: p: i; G1 Z' p3 g! Z: } reboot5 d- a0 K D3 `
fi |
评分
-
查看全部评分
|