X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=apache.init;h=5960a47d8bec452c0037b426c6299a832e219b0e;hb=c7b3b2e26aa7cc97c4bae015cf95683b555f1dbb;hp=1808f709555aa7f37bb5fb4ca809126620e8546d;hpb=861999bad0c484b8b7bd9df6f3a25afe476a0c22;p=packages%2Fapache.git diff --git a/apache.init b/apache.init index 1808f70..5960a47 100644 --- a/apache.init +++ b/apache.init @@ -50,25 +50,24 @@ configtest() { checkconfig() { local details=${1:-0} - if [ $details = 1 ]; then + if [ $details -eq 1 ]; then # run config test and display report (status action) show "Checking %s configuration" "$SVC_NAME"; busy local out out=`configtest 2>&1` RETVAL=$? - if [ $RETVAL = 0 ]; then - ok - else - fail - fi + [ $RETVAL -eq 0 ] && ok || fail [ "$out" ] && echo >&2 "$out" else # run config test and abort with nice message if failed # (for actions checking status before action). + show "Checking %s configuration" "$SVC_NAME"; busy configtest >/dev/null 2>&1 RETVAL=$? - if [ $RETVAL != 0 ]; then - show "Checking %s configuration" "$SVC_NAME"; fail + if [ $RETVAL -eq 0 ]; then + ok + else + fail nls 'Configuration test failed. See details with %s "checkconfig"' $0 exit $RETVAL fi @@ -139,6 +138,7 @@ case "$1" in stop ;; restart) + checkconfig stop start ;; @@ -146,7 +146,7 @@ case "$1" in condrestart 0 ;; reload|force-reload|graceful|flush-logs) - reload + reload ;; checkconfig|configtest) checkconfig 1