From: Kevin Darbyshire-Bryant Date: Sun, 3 Oct 2021 10:23:36 +0000 (+0100) Subject: collectd: sqm_collect: optimise parent search X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=9db12bbaffd997fe3ba2959b7370b3a9b59401f6;p=openwrt-packages.git collectd: sqm_collect: optimise parent search There can be only 1 parent process ID, so as soon as we find it, print it and exit - there's no point searching any of the following lines Signed-off-by: Kevin Darbyshire-Bryant --- diff --git a/utils/collectd/files/exec-scripts/sqm_collectd.sh b/utils/collectd/files/exec-scripts/sqm_collectd.sh index 690837017..07fe55515 100755 --- a/utils/collectd/files/exec-scripts/sqm_collectd.sh +++ b/utils/collectd/files/exec-scripts/sqm_collectd.sh @@ -100,7 +100,7 @@ process_qdisc() { } # while not orphaned -while [ $(awk '$1 ~ "^PPid:" {print $2}' /proc/$$/status) -ne 1 ] ; do +while [ $(awk '$1 ~ "^PPid:" {print $2;exit}' /proc/$$/status) -ne 1 ] ; do for ifc in "$@" ; do process_qdisc "$ifc" done