Apache 2 - am I doing it wrong?

Scott Haneda talklists at newgeo.com
Thu Sep 10 13:18:49 PDT 2009


On Sep 10, 2009, at 12:28 PM, Bradley Giesbrecht wrote:

>> What does your apache shell script look like that starts, stops,  
>> and reloads?
>
> If you have launchd monitoring a service that launchd is supposed to  
> launch if it crashes I'm afraid all your apachectl type apps that  
> kill and then start services will not work well. Launchd will see  
> the service go away and fire it back up and apachectl type apps will  
> also be starting the service. Things like postfix/postconf that can  
> alter a configuration without bouncing the process shouldn't have  
> this problem.
>
> So I just write very simple scripts like:
>
> loadapache.sh
> #!/bin/bash
> launchctl load -w /Library/LaunchDaemons/org.macports.apache.plist
>
> unloadapache.sh
> #!/bin/bash
> launchctl unload -w /Library/LaunchDaemons/org.macports.apache.plist
>
> reloadapache.sh
> #!/bin/bash
> unloadapache.sh
> sleep 5
> loadapache.sh

Ok, you are using -w to write out a kill of it.  I have tried that  
too.  Try it, unload it, and then look at `ps` and it is still alive.   
How long do those take to die?

This is also pretty brute force, whereas apachectl graceful does not  
interrupt users on the site.  The above method, you could have a  
halfway completed account registration for a user, and very easily  
create a account record, they get the site is down on a insert for the  
user record, and you now have a mess to clean.

Maybe graceful works as it is supposed to, I am just not used to  
seeing those processes in the ps list.
-- 
Scott * If you contact me off list replace talklists@ with scott@ *



More information about the macports-users mailing list