[PATCH v2 5/5] nodewatcher: Exit nodewatcher if subscript fails

Fabian Bläse fabian at blaese.de
Mi Apr 22 16:05:27 CEST 2020


If a subscript exits with an exit status != 0, its output should not
be used. Because sending incomplete data sets might result in weird
edge cases, the nodewatcher is terminated and the output of other
subscripts is discarded.

Signed-off-by: Fabian Bläse <fabian at blaese.de>
---
Changes in v2:
- 'exit 1' instead of 'continue'
---
 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 8b55656..26710b3 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, exiting!"
+			exit 1
+		fi
 		DATA="$DATA$tmp"
 	done
 
-- 
2.26.2



Mehr Informationen über die Mailingliste franken-dev