I'm working on a bash script that rewrites vhost files and then restarts apache to pick up the changes. It all works fine but I want to check the status of apachectl before restarting apache in case the vhost files have syntax errors.
I know how to run apachectl -S from the command line, but I want my script to work like:
service httpd restart
I guess I could just parse the output and look for 'Syntax OK' but is there a better way?