続きです。。
せっかくなので、hostconfigを書き換えて、自動起動する設定も施してみました。
とりあえず、InterfaceBuilderでボタンを配置して、表示を
Start Apache2 At Bootなどとします。
さて、これにスクリプトを割り当てていくのですが。。。
まず最初に、Inspectorウインドウで、Applescriptでコントロールする名前を、
switch
としました。
んで、このボタン用のApplescriptを新しく作ります。
新しいスクリプトは
switch.applescriptにしました。

そして、switch.actionscriptは、こんな感じで、hostconfigを書き換えるスクリプトを書きました。
CODE:
on clicked theObject
if state of theObject is 1 then
try
--do shell script "grep APACHE2= /Users/u_ichi/Desktop/hostconfig" with administrator privileges
do shell script "grep APACHE2= /etc/hostconfig" with administrator privileges
do shell script "cp /etc/hostconfig /etc/hostconfig.bak" with administrator privileges
do shell script "sed -e s/APACHE2=-NO-/APACHE2=-YES-/ /etc/hostconfig.bak > /etc/hostconfig" with administrator privileges
--display dialog "ON"
on error
do shell script "cp /etc/hostconfig /etc/hostconfig.bak" with administrator privileges
do shell script "echo APACHE2=-YES- | tee -a /etc/hostconfig" with administrator privileges
end try
else
try
do shell script "grep APACHE2= /etc/hostconfig" with administrator privileges
do shell script "cp /etc/hostconfig /etc/hostconfig.bak" with administrator privileges
do shell script "sed -e s/APACHE2=-YES-/APACHE2=-NO-/ /etc/hostconfig.bak > /etc/hostconfig" with administrator privileges
--display dialog "OFF"
on error
do shell script "cp /etc/hostconfig /etc/hostconfig.bak" with administrator privileges
do shell script "echo APACHE2=-NO- | tee -a /etchostconfig" with administrator privileges
end try
end if
end clicked
そして、アプリケーションが起動したときに、switchの状態を設定しなければならないので、起動時に実行されるwindow.applescriptのほうにも以下を付け加えます。
CODE:
try
do shell script "grep APACHE2=-YES- /etc/hostconfig"
set state of button "switch" of window "mainwindow" to "1"
on error
end try
テストしてみます。

うまくいったようです。
一応、作ったヤツをココにおいておきます。
※
こちらのApache2.3+PHP5 とあわせて使えます。
※/usr/local/apache2 にインストールしたApacheなら、他のバージョンのApacheでも使えます。