|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。
q4 V7 k* H$ v" g3 v#!/bin/bash
/ H, M- Y% C @# ?: i" ddt=`date '+%d/%m/%Y %H:%M:%S'`; |* @2 W( R( i8 I: w# {0 I
sleep 60% t* o5 ]: J0 ], ~! J5 m8 ^
> /result.txt
# ~; B, r" Q6 g# Mnum=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
3 n* m+ W/ z$ d; C+ x* a% @+ n8 eecho $num
& Z- e/ h; k" z, G' \0 C i5 recho $?. W2 P% n" _5 [+ x( @' |8 ]/ X
if [ $? -eq 0 -a $num -eq 0 ]; then
; a0 Y: M/ @' e. m5 S1 _ echo "$dt ok" >> /result.txt4 ~* P8 I& x% T( s" D2 P4 G
else) M( f' S' w8 x2 V3 S5 @: f0 [
echo "$dt noip loss $num reboot" >> /result.txt* B; e3 T1 z- Q- u; a
reboot# n3 [) @% M2 n8 W9 C. H% V
fi |
评分
-
查看全部评分
|