3 LOG
="/usr/bin/logger -t $(basename "$0")[$$] -p"
7 $LOG notice
"Stopping mwan3track for interface \"${INTERFACE}\""
8 rm "/var/run/mwan3track-${INTERFACE}.pid" &> /dev
/null
14 [ -z "$12" ] && echo "Error: should not be started manually" && exit 0
17 echo "$$" > /var
/run
/mwan3track-
$1.pid
18 trap clean_up SIGINT SIGTERM
20 local score
=$
(($7+$8))
21 local track_ips
=$
(echo $
* | cut
-d ' ' -f 12-99)
30 for track_ip
in $track_ips; do
31 ping -I $2 -c $4 -W $5 -s $9 -q $track_ip &> /dev
/null
39 if [ $host_up_count -lt $3 ]; then
42 if [ $score -lt $8 ]; then
48 if [ $score -eq $8 ]; then
49 $LOG notice
"Interface $1 ($2) is offline"
50 env
-i ACTION
=ifdown INTERFACE
=$1 DEVICE
=$2 /sbin
/hotplug-call iface
54 if [ $score -lt $
(($7+$8)) ] && [ $lost -gt 0 ]; then
55 $LOG info
"Lost $(($lost*$4)) ping(s) on interface $1 ($2)"
61 if [ $score -gt $8 ]; then
63 elif [ $score -le $8 ]; then
67 if [ $score -eq $8 ]; then
68 $LOG notice
"Interface $1 ($2) is online"
69 env
-i ACTION
=ifup INTERFACE
=$1 DEVICE
=$2 /sbin
/hotplug-call iface
70 rm /var
/run
/mwan3track-
$1.pid