You could use apachectl configtest
(or its equivalent apachectl -t
) to check the current configuration. And only if it reports success. Would be quite simple:
apachectl configtest && apachectl graceful
Or:
apachectl -t && apachectl -k graceful
(The above apachectl -S
is more of a human readable debugging thing IMO.)