#!/bin/bash # # corz.org 2000-> # # this is a handy script to put in your PATH, usually /usr/local/bin # this is the first of the series* of apache control scripts # not exactly rocket science, but anything that saves precious # keystrokes is okay in my book. # # * which goes some way to explain why the others begin with "r" # and not "a" # # ;o) # (or # # RESTART APACHE! # # 2009 - added *Ubuntu apache2 echo echo `date "+%m.%d.%y-%H.%M"`": restarting apache.." echo # 1st, let's try the default apache2 location if [ -e /usr/local/apache2/bin/apachectl ];then echo " " sudo /usr/local/apache2/bin/apachectl graceful exit 0 fi # then we check the "complete apache2".. if [ -e /Library/Apache2/bin/apachectl ];then echo " " sudo /Library/Apache2/bin/apachectl graceful exit 0 fi # now we'll look for the OS X Server "opt" location.. # this goes after other regular/mac installs because you may have it and not realise it! if [ -e /opt/Apache2/bin/apachectl ];then echo " " sudo /opt/Apache2/bin/apachectl graceful exit 0 fi # lampp maybe.. if [ -e /opt/lampp/bin/apachectl ];then echo " " sudo /opt/lampp/bin/apachectl graceful exit 0 fi # Linux package (Slackware or similar distro package) if [ -e /usr/sbin/apachectl ];then echo " " sudo /usr/sbin/apachectl -k graceful exit 0 fi # Another Linux package (Ubuntu or similar distro package) if [ -e /usr/sbin/apache2ctl ];then echo " " sudo /usr/sbin/apache2ctl -k graceful exit 0 fi # if it isn't restarted by now, you must be running Apache 1.3.. echo " " sudo /usr/local/apache/bin/apachectl graceful # the other apache control scripts follow the same format