From 8de0577b9daad4baa0a71babf0732a677f027386 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 19 Nov 2009 20:33:55 +0000 Subject: [PATCH] - run checkconfig only once (it trashes syslog no matter what, so do it at least once then) Changed files: dhcp6.init -> 1.6 --- dhcp6.init | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dhcp6.init b/dhcp6.init index 469171e..08a13af 100644 --- a/dhcp6.init +++ b/dhcp6.init @@ -50,16 +50,22 @@ configtest() { } # wrapper for configtest +checkconfig=-1 checkconfig() { local details=${1:-0} + # run checkconfig only once + if [ "$checkconfig" != -1 ]; then + return $checkconfig + fi + if [ $details = 1 ]; then # run config test and display report (status action) show "Checking %s configuration" "DHCP IPv6 Server"; busy local out out=$(configtest 2>&1) - RETVAL=$? - if [ $RETVAL = 0 ]; then + checkconfig=$? + if [ $checkconfig = 0 ]; then ok else fail @@ -69,11 +75,11 @@ checkconfig() { # run config test and abort with nice message if failed # (for actions checking status before action). configtest >/dev/null 2>&1 - RETVAL=$? - if [ $RETVAL != 0 ]; then + checkconfig=$? + if [ $checkconfig != 0 ]; then show "Checking %s configuration" "DHCP IPv6 Server"; fail nls 'Configuration test failed. See details with %s "checkconfig"' $0 - exit $RETVAL + exit $checkconfig fi fi } -- 2.43.0