|
|
发表于 2019-10-12 20:06:50
|
显示全部楼层
老哥 我优化了下,丢包重启。。。
6 I& ?% g n, ~8 ~4 e7 I" @#!/bin/bash
! V& U5 j" r( a( } e: h/ W: @dt=`date '+%d/%m/%Y %H:%M:%S'`
* k+ M- S& v! a+ I. E' ?" dsleep 60
. A/ ~$ b2 M, R6 @5 [> /result.txt- @8 Z( W4 I( H+ j
num=`ping -c20 192.168.2.1 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`$ i( b" |" m L3 d9 i
echo $num6 W& U" H5 I- C& ?' E
echo $?9 ?, u/ n' r S/ ]- K
if [ $? -eq 0 -a $num -eq 0 ]; then
% h2 \ D. F& U. g w* q echo "$dt ok" >> /result.txt9 p/ w1 h: E( ?1 |
else, z8 v1 B( z6 G7 P `4 z
echo "$dt noip loss $num reboot" >> /result.txt
3 l% e# K4 U; V) Z8 e reboot
4 [3 W1 n) w6 w! t* gfi |
评分
-
查看全部评分
|