net/mwan3: fix mwan3track kill execution

If two interface have the same prefix "wan" for example "wan" and "wan1"
pgrep returns the PID for wan1 also "pgrep -f mwan3track wan".

Before this fix "wan1" was also killed! This is not what we want.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2017-07-31 11:46:21 +02:00
parent 487278dcd1
commit 0b44ca505b
4 changed files with 10 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
#!/bin/sh
. /lib/functions.sh
. /lib/functions/network.sh
. /usr/share/libubox/jshn.sh
MWAN3_STATUS_DIR="/var/run/mwan3track"
@@ -34,10 +35,12 @@ get_mwan3_status() {
local iface="${1}"
local iface_select="${2}"
local running="0"
local pid
local pid device
network_get_device device $1
if [ "${iface}" = "${iface_select}" ] || [ "${iface_select}" = "" ]; then
pid="$(pgrep -f "mwan3track $iface")"
pid="$(pgrep -f "mwan3track $iface $device")"
if [ "${pid}" != "" ]; then
running="1"
fi