|
|
#!/bin/bash! q+ E& l! W: y& }2 B- x
dt=`date '+%d/%m/%Y %H:%M:%S'`
/ s: I4 |2 X1 J) Asleep 60;
2 t. ~& N/ ]4 h/ E) ]; A" v# \> /result.txt" E0 L/ |8 p' Z0 J
num=`ping -c20 192.168.3.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
% S' x) W; |' A1 i& p& Y6 Jecho $num3 Q' N; H5 G6 b, ?" X9 H
echo $?
% n* H u( A% }7 L" r gif [ $? -eq 0 -a $num -eq 0 ]; then+ B( ?" C. a" I: { t8 f9 [
echo "$dt ok" >> /result.txt
. A2 `4 N# I) k" N* l. w/ }4 P4 selse
* B0 `$ O) o5 a+ o/ x! \ w3 a echo "$dt noip loss $num reboot" >> /result.txt0 J1 Q. o/ Z3 H
reboot0 a3 E; O9 Y, t X: I5 |
fi |
|