From 88b66dca24b63139c08a10c7adc211d3048173a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S=C3=89RIE?= Date: Wed, 3 Oct 2018 15:16:28 +0200 Subject: [PATCH] Evoacme: Better usage of apache2ctl -t By default apache2ctl is using stderr, even for displaying "Syntax OK". So, we redirect it in stdout and remove "Syntax OK". Then we check the exit code. --- evoacme/files/evoacme.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/evoacme/files/evoacme.sh b/evoacme/files/evoacme.sh index c4594ad1..b1837992 100755 --- a/evoacme/files/evoacme.sh +++ b/evoacme/files/evoacme.sh @@ -55,7 +55,10 @@ sed_cert_path_for_apache() { sed -i "s~${search}~${replace}~" "${vhost_full_path}" debug "Config in ${vhost_full_path} has been updated" - $(command -v apache2ctl) -t + $(command -v apache2ctl) -t 2>&1 | grep -v "Syntax OK" + if [ "${PIPESTATUS[0]}" != "0" ]; then + error "Apache config test has exited with a non-zero exit code" + fi fi } sed_cert_path_for_nginx() {