bash script to restart apache if apachectl passes -
i'm working on bash script rewrites vhost files , restarts apache pick changes. works fine want check status of apachectl before restarting apache in case vhost files have syntax errors.
i know how run apachectl -s command line, want script work like:
if(apachectl passes){     service httpd restart  }   i guess parse output , 'syntax ok' there better way?
you can just:
if apachectl -s;   service httpd restart else   // action if config parsing failed fi   apachectl result non 0 exit code, jumping else branch.
Comments
Post a Comment