From ec45ff8052394f0d0fa711ba30e19e981312f79c Mon Sep 17 00:00:00 2001 From: Aaron Goodman Date: Thu, 4 Jun 2020 16:43:23 -0400 Subject: [PATCH] mwan3: be more efficient with sleep after killing trackers Signed-off-by: Aaron Goodman (cherry picked from commit 84a53b7c792217ccb0a3d95e8fcf63d2843cdc43) --- net/mwan3/files/lib/mwan3/mwan3.sh | 4 +++- net/mwan3/files/usr/sbin/mwan3 | 14 ++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index eecd4a3807..ddc8f2012a 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -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 diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index a854dfda28..11e8e3dcab 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -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 -- 2.30.2