[PATCH 3/4] nodewatcher: Only include subscripts result if executed successfully

Fabian Bläse fabian at blaese.de
So Apr 19 15:40:19 CEST 2020


If a subscript exits with an exit status != 0, its output should not
be used. Therefore, it is discarded.

Other scripts should not be affected by this, so the execution of
nodewatcher is continued.

Signed-off-by: Fabian Bläse <fabian at blaese.de>
---
 src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
index 1226f49..f7b6778 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
@@ -29,6 +29,10 @@ crawl() {
 
 	for f in /usr/lib/nodewatcher.d/*.sh; do
 		tmp="$($f)"
+		if [ $? -ne 0 ]; then
+			debug "Error when executing subscript $1, discarding its result!"
+			continue
+		fi
 		DATA="$DATA$tmp"
 	done
 
-- 
2.26.0



Mehr Informationen über die Mailingliste franken-dev