|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。
0 ~" d/ Y# F. C: I( s( P/ B#!/bin/bash1 |) J; m9 e* x) N+ y" Y+ p
dt=`date '+%d/%m/%Y %H:%M:%S'`. A- n0 W& y5 e2 v5 x. K
sleep 60
2 q5 Y, P1 ~, L) u> /result.txt+ F6 z# P, J& l) @+ Q0 c7 C, o
num=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`/ h5 K2 x3 v' @& ~! p# t6 c2 }: X
echo $num, j2 _# h4 z1 A% o8 h# l" T _
echo $?7 ?, L4 h: }' [7 i2 _" B
if [ $? -eq 0 -a $num -eq 0 ]; then
- ]: c( U( l" h* H4 E* M, t echo "$dt ok" >> /result.txt( W2 \; D2 y2 y* W
else
* f3 B" j5 f1 J echo "$dt noip loss $num reboot" >> /result.txt
! H) J2 \4 F, z9 C5 D' M5 e- S reboot$ V% x0 f) J) v
fi |
评分
-
查看全部评分
|