Strange quit behavior

Alex Sharp ajsharp at
Tue Aug 2 19:49:11 EDT 2011

On Tue, Aug 2, 2011 at 4:08 PM, Eric Wong <normalperson at> wrote:
> James Cox <james at> wrote:
>> So what should that look like? all but that nr-workers stuff? can i
>> just remove the before fork? and what would you say is a super good
>> unicorn config to start from?
> Yeah, skip the before_fork and also after_fork.  Those are mainly for
> disconnect/reconnect of ActiveRecord and anything else that might need a
> network connection.

FWIW, we use the before_fork hook to automatically kill the old master
by sending it QUIT:

before_fork do |server, worker|
  old_pid = '/var/www/api/shared/pids/'

  if File.exists?(old_pid) && != old_pid
    rescue Errno::ENOENT, Errno::ESRCH
      # another newly forked workers has already killed it

- alex

More information about the mongrel-unicorn mailing list