mwan3_track()
{
local track_ip track_ips reliability count timeout interval down up size
+ local failure_interval recovery_interval
mwan3_list_track_ips()
{
config_get count $1 count 1
config_get timeout $1 timeout 4
config_get interval $1 interval 10
+ config_get failure_interval $1 failure_interval $interval
+ config_get recovery_interval $1 recovery_interval $interval
config_get down $1 down 5
config_get up $1 up 5
config_get size $1 size 56
- [ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track $1 $2 $reliability $count $timeout $interval $down $up $size $track_ips &
+ [ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track $1 $2 $reliability $count $timeout $interval $down $up $size $failure_interval $recovery_interval $track_ips &
fi
}
#!/bin/sh
-[ -z "$10" ] && echo "Error: should not be started manually" && exit 0
+[ -z "$12" ] && echo "Error: should not be started manually" && exit 0
if [ -e /var/run/mwan3track-$1.pid ] ; then
kill $(cat /var/run/mwan3track-$1.pid) &> /dev/null
echo "$$" > /var/run/mwan3track-$1.pid
score=$(($7+$8))
-track_ips=$(echo $* | cut -d ' ' -f 10-99)
+track_ips=$(echo $* | cut -d ' ' -f 12-99)
host_up_count=0
lost=0
+sleep_time=0
while true; do
+ sleep_time=$6
+
for track_ip in $track_ips; do
ping -I $2 -c $4 -W $5 -s $9 -q $track_ip &> /dev/null
if [ $? -eq 0 ]; then
if [ $host_up_count -lt $3 ]; then
let score--
- if [ $score -lt $8 ]; then score=0 ; fi
+ if [ $score -lt $8 ]; then
+ score=0
+ else
+ sleep_time=$10
+ fi
+
if [ $score -eq $8 ]; then
logger -t mwan3track -p notice "Interface $1 ($2) is offline"
let score++
lost=0
- if [ $score -gt $8 ]; then score=$(($7+$8)); fi
+ if [ $score -gt $8 ]; then
+ score=$(($7+$8))
+ elif [ $score -le $8 ]; then
+ sleep_time=$11
+ fi
+
if [ $score -eq $8 ]; then
logger -t mwan3track -p notice "Interface $1 ($2) is online"
fi
host_up_count=0
- sleep $6
+ sleep $sleep_time
done
exit 1