Toggle Apache server On/Off

I want to use an Applescript to toggle my Apache server on and off. I found a script in the forums but it contained some characters that were unrecogized. Can anyone point me to an already existing script or give me some tips on how to right one?


You can execute a shell script to control the apache server. For example, to start the server (assuming it’s stopped), use…

set apacheResult to do shell script "apachectl start"

Then, to stop it, you would do…

do shell script "apachectl stop"

There are other options for the apachectl command, including various restarting and status options (some of which are not available with the base install of apache on mac osx), discussed at: [url=][/url]. Executing this in a try/on error block, in coordination with evaluating the response from the “apacheResult” variable returned from the shell script, you can control how your script exits and handles errors.

Have fun…