From: Kevin Darbyshire-Bryant Date: Tue, 28 Sep 2021 09:42:45 +0000 (+0100) Subject: collectd: sqm_collect: handle being orphaned X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8322059f01abaabc293b854dc4f1768816654f52;p=feed%2Fpackages.git collectd: sqm_collect: handle being orphaned If the master collectd instance gets shut down in an uncontrolled manner (crashes!) then sqm_collect scripts will be left orphaned and will run forever. Modify script to check if it still has a parent and if not, exit. Signed-off-by: Kevin Darbyshire-Bryant --- diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile index ab78064119..10bd70ef12 100644 --- a/utils/collectd/Makefile +++ b/utils/collectd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=collectd PKG_VERSION:=5.12.0 -PKG_RELEASE:=12 +PKG_RELEASE:=13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://collectd.org/files/ \ diff --git a/utils/collectd/files/exec-scripts/sqm_collectd.sh b/utils/collectd/files/exec-scripts/sqm_collectd.sh index ad84fc762a..690837017e 100755 --- a/utils/collectd/files/exec-scripts/sqm_collectd.sh +++ b/utils/collectd/files/exec-scripts/sqm_collectd.sh @@ -99,7 +99,8 @@ process_qdisc() { json_cleanup } -while true ; do +# while not orphaned +while [ $(awk '$1 ~ "^PPid:" {print $2}' /proc/$$/status) -ne 1 ] ; do for ifc in "$@" ; do process_qdisc "$ifc" done