mwan3: be more efficient with sleep after killing trackers
authorAaron Goodman <aaronjg@stanford.edu>
Thu, 4 Jun 2020 20:43:23 +0000 (16:43 -0400)
committerAaron Goodman <aaronjg@stanford.edu>
Thu, 16 Jul 2020 06:03:21 +0000 (02:03 -0400)
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
net/mwan3/files/lib/mwan3/mwan3.sh
net/mwan3/files/usr/sbin/mwan3

index eecd4a380778566bde0448a622b41b1dbc499abe..ddc8f2012a8f31edb5e08bedf81e397965f1574c 100644 (file)
@@ -672,7 +672,9 @@ mwan3_track()
 
        for pid in $(pgrep -f "mwan3track $1 $2"); do
                kill -TERM "$pid" > /dev/null 2>&1
-               sleep 1
+       done
+       sleep 1
+       for pid in $(pgrep -f "mwan3track $1 $2"); do
                kill -KILL "$pid" > /dev/null 2>&1
        done
        if [ -n "$track_ips" ]; then
index a854dfda2818a97a7ea2ad2d020ef7d89e394947..11e8e3dcab8dc8f375a6e293956c620e1aae0fc9 100755 (executable)
@@ -64,7 +64,7 @@ ifup()
        status=$(ubus -S call network.interface.$1 status)
        [ -n "$status" ] && {
                json_load "$status"
-               json_get_vars up l3_device 
+               json_get_vars up l3_device
        }
 
        config_get enabled "$1" enabled 0
@@ -141,13 +141,19 @@ stop()
 
        for pid in $(pgrep -f "mwan3rtmon"); do
                kill -TERM "$pid" > /dev/null 2>&1
-               sleep 1
-               kill -KILL "$pid" > /dev/null 2>&1
        done
 
        for pid in $(pgrep -f "mwan3track"); do
                kill -TERM "$pid" > /dev/null 2>&1
-               sleep 1
+       done
+
+       sleep 1
+
+       for pid in $(pgrep -f "mwan3rtmon"); do
+               kill -KILL "$pid" > /dev/null 2>&1
+       done
+
+       for pid in $(pgrep -f "mwan3track"); do
                kill -KILL "$pid" > /dev/null 2>&1
        done