slacker
November 27, 2008, 5:37pm
#1
try
do shell script "ping -c localhost"
return do shell script "/apache2/bin/apachectl stop" with administrator privileges
on error
return do shell script "/apache2/bin/apachectl start" with administrator privileges
end try
Why wont apache turn off when apache is on?
Here on my Mac the ping command used in «do shell script» already throws an exception:
ping: invalid count of packets to transmit: `localhost’
Therefor the second command, which is supposed to turn Apache off, is never executed. Instead the Apache start command is launched.
slacker
November 27, 2008, 10:39pm
#3
Here on my Mac the ping command used in «do shell script» already throws an exception:
ping: invalid count of packets to transmit: `localhost’
Therefor the second command, which is supposed to turn Apache off, is never executed. Instead the Apache start command is launched.
Sooo how would i fix this?
Your ping instruction should be:
do shell script "ping -c 1 localhost"
“-c” calls for an integer number of pings to be sent, then the address follows.