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.
This commit is contained in:
Benoît S. 2018-10-03 15:16:28 +02:00
parent f2469dbdd9
commit 88b66dca24

View file

@ -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() {