|
|
@ -55,6 +55,7 @@ main() { |
|
|
|
local recovery_interval down up size |
|
|
|
local keep_failure_interval check_quality failure_latency |
|
|
|
local recovery_latency failure_loss recovery_loss |
|
|
|
local max_ttl |
|
|
|
|
|
|
|
[ -z "$5" ] && echo "Error: should not be started manually" && exit 0 |
|
|
|
|
|
|
@ -84,6 +85,7 @@ main() { |
|
|
|
config_get down $1 down 5 |
|
|
|
config_get up $1 up 5 |
|
|
|
config_get size $1 size 56 |
|
|
|
config_get max_ttl $1 max_ttl 60 |
|
|
|
config_get failure_interval $1 failure_interval $interval |
|
|
|
config_get_bool keep_failure_interval $1 keep_failure_interval 0 |
|
|
|
config_get recovery_interval $1 recovery_interval $interval |
|
|
@ -120,10 +122,10 @@ main() { |
|
|
|
case "$track_method" in |
|
|
|
ping) |
|
|
|
if [ $check_quality -eq 0 ]; then |
|
|
|
ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null |
|
|
|
ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null |
|
|
|
result=$? |
|
|
|
else |
|
|
|
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip | tail -2)" |
|
|
|
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip | tail -2)" |
|
|
|
loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')" |
|
|
|
if [ "$loss" -eq 100 ]; then |
|
|
|
latency=999999 |
|
|
|