From patchwork Wed Apr 22 14:05:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [v2,5/5] nodewatcher: Exit nodewatcher if subscript fails From: Fabian Blaese X-Patchwork-Id: 1354 Message-Id: <20200422140527.894934-5-fabian@blaese.de> To: franken-dev@freifunk.net Date: Wed, 22 Apr 2020 16:05:27 +0200 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 Acked-by: Adrian Schmutzler --- 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