I'd like to have a single command that'll restart Apache on any *nix OS. Currently I'm working with Ubuntu, which has
/usr/sbin/apache2ctl
/usr/sbin/service
- no
apachectl
- no
httpd
and Scientific Linux CERN 5, which has
/usr/sbin/apachectl
/etc/init.d/httpd
- no
apache2ctl
- no
service
I'd like to avoid using a hack like which service 2>/dev/null || which /etc/init.d/httpd
apachectl / apache2ctl is the apache built in tool to control apache, it's probably the right tool to use in your case as it comes with apache it will be the some on all OS.
apachectl is normally for Apache 1.x and apache2ctl for Apache 2.x.
If SLC5 comes with Apache 2.x it's quite strange but you could run both apachectl and apache2ctl in your script.
You could use a script that checks which apachectl is installed and then run the appropriate one.