|
|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。 i+ U, s% P! o; N+ A' z! p2 j
#!/bin/bash
8 V/ Z: { K% W+ ?* {dt=`date '+%d/%m/%Y %H:%M:%S'`) W2 [/ T$ Y" j: c7 f
sleep 60
. i2 r. Q7 B+ D> /result.txt
1 Z9 N8 D& H- U8 }6 g3 Onum=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
; R6 |/ t' X3 g1 Y. v. X, xecho $num' w) c Y8 ?; G! t! M! l* w5 v& A
echo $?
2 P, c' y" P0 V$ @' w; i: fif [ $? -eq 0 -a $num -eq 0 ]; then
, }8 x8 J( P8 | echo "$dt ok" >> /result.txt, t" z' m" ^, X+ b6 P& h
else" M/ |! y x# b4 B2 _, J
echo "$dt noip loss $num reboot" >> /result.txt
% }/ G# h2 \# o; x! ?" P7 M$ B0 p reboot
; |/ D l! y J# @, j3 x4 s7 c& `fi |
评分
-
查看全部评分
|