On Jun 14, 2007, at 12:17 PM, Alain Hoang wrote:
>> I'm feeling that killing processes is not a "best practice", thus I'm
>> interested in any suggestions.
>
> If you want a more ordered manner for starting and stopping server
> processes on the Mac you probably want to look into using launchd to
> start up and stop nginx.

launchd or StartupItems

This is a bit of a mess.

StartupItems is the old way:  you put a script and some metadata in  
the /Library/StartupItems folder (see other ones in there for an  
example, or grab http://www2.entropy.ch/download/pgsql- 
startupitem-1.2.pkg.tar.gz).  apps are started and stopped as defined  
in the script, and can be turned on or off (for restart) in the /etc/ 
hostconfig file.

The good news is that this is fairly easy to set up.  The bad news is  
it's somewhat deprecated and will go away at some point in the future.

launchd is the new way:  you put an xml config file in one of a  
number of places and the system magically does the right thing,  
starting, stopping, restarting, and monitoring your process as  
necessary.  It's magic in both good and bad ways.

The good news is that this is the future that Apple intends to  
support, and that it's (allegedly) pretty powerful once you  
understand how it all works.  The bad news is it's harder to  
understand, harder to set up, and doesn't entirely work yet for some  
purposes.  Specifically it doesn't deal well with processes that  
detach at start and then do a clean shutdown by sending a signal from  
another process (e.g. apachctl, pg_ctl).

Short of learning all about both, you can probably summarize the  
decision as:  If you can run nginx in a shell and then hit ctrl-c, or  
if sending it a HUP causes a clean shutdown, then launchd is probably  
the "right" way.  If you want to get this working today and are  
willing to spend more time on The Right Thing later then StartupItems  
is probably your best bet.

-faisal


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Deploying Rails" group.
To post to this group, send email to rubyonrails-deployment@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to