From 8322059f01abaabc293b854dc4f1768816654f52 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 28 Sep 2021 10:42:45 +0100 Subject: [PATCH] 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 --- utils/collectd/Makefile | 2 +- utils/collectd/files/exec-scripts/sqm_collectd.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 -- 2.30.2