|
|
#!/bin/bash6 n5 v, ?& E& i! b" |' x- [4 o
dt=`date '+%d/%m/%Y %H:%M:%S'`
* j: H/ y n& a5 xsleep 60;5 o0 ]1 q! N8 ]7 l8 d( _
> /result.txt0 i7 m4 p) } C6 Y
num=`ping -c20 192.168.3.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`8 C, ^2 c2 S6 s* f5 R. V5 N
echo $num
6 M6 s; B- C' o/ vecho $?
5 T4 Q$ A5 ~# J5 J/ V, wif [ $? -eq 0 -a $num -eq 0 ]; then
1 i2 `: |/ E& K# i. }7 P" [ echo "$dt ok" >> /result.txt0 X: O4 R0 k" S/ b3 B: |
else
& z, u6 R4 @/ k5 t1 M& Q, C echo "$dt noip loss $num reboot" >> /result.txt; r: G2 U- b# h0 O
reboot
9 F% _. I. W8 p f1 efi |
|