|
|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。% O& M4 }; A) O& Y- L o! N
#!/bin/bash4 c8 O! t9 L+ s" p9 J
dt=`date '+%d/%m/%Y %H:%M:%S'`
0 [1 c3 Y! {: `$ z( M9 |- @sleep 60, ?4 ^( B% G1 j4 u. \: U8 ~. X! B8 B
> /result.txt
?' s3 ~( C6 a3 C" jnum=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
% h' f2 Y, b% |: F; d- v/ cecho $num
. z# g# p; J# _* k* K$ Gecho $?
8 D3 K1 q& G2 [; j6 _2 Cif [ $? -eq 0 -a $num -eq 0 ]; then% H/ L9 a* t) _2 T7 V7 H" R
echo "$dt ok" >> /result.txt
: p% ]8 S" Z6 U: c3 Q1 ?+ jelse1 ? I5 P4 G. W1 s/ ^+ s" t
echo "$dt noip loss $num reboot" >> /result.txt
# G+ M8 a, K3 o reboot
+ h( n, n! n$ ~fi |
评分
-
查看全部评分
|