diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 05ee9eedf..3d64ec44b 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -446,7 +446,7 @@ mwan3_delete_iface_ipset_entries() mwan3_track() { - local track_ip track_ips + local track_ip track_ips pid mwan3_list_track_ips() { @@ -454,7 +454,11 @@ mwan3_track() } config_list_foreach $1 track_ip mwan3_list_track_ips - kill $(pgrep -f "mwan3track $1 $2") &> /dev/null + for pid in $(pgrep -f "mwan3track $1 $2"); do + kill -TERM "$pid" > /dev/null 2>&1 + sleep 1 + kill -KILL "$pid" > /dev/null 2>&1 + done if [ -n "$track_ips" ]; then [ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track "$1" "$2" "$3" "$4" $track_ips & fi diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index 3e1b64456..5c4259c7d 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -132,9 +132,13 @@ start() stop() { - local ipset route rule table IP IPT + local ipset route rule table IP IPT pid - killall mwan3track &> /dev/null + for pid in $(pgrep -f "mwan3track"); do + kill -TERM "$pid" > /dev/null 2>&1 + sleep 1 + kill -KILL "$pid" > /dev/null 2>&1 + done config_load mwan3 config_foreach mwan3_track_clean interface diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 588eb9bf4..2e6f0ffdd 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -62,8 +62,8 @@ main() { STATUS=$3 SRC_IP=$4 mkdir -p /var/run/mwan3track/$1 - trap clean_up SIGINT SIGTERM - trap if_down SIGUSR1 + trap clean_up TERM + trap if_down USR1 config_load mwan3 config_get track_method $1 track_method ping