"unicorn -D" always returns 0 "success" (even when failed to load)

Eric Wong normalperson at yhbt.net
Thu Dec 24 14:34:33 EST 2009

Iñaki Baz Castillo <ibc at aliax.net> wrote:
> El Miércoles, 23 de Diciembre de 2009, Eric Wong escribió:
> However I'm building my app now and when start it it usually has errors, and 
> that's good as it means I'm working :)
> But sincerelly I would like to see the error just once rather than many times 
> due to workers respawn :)
> Also, is there any "interval" parameter so a worker is not re-spawned until 
> such timeout (after die).

You can sleep in the before_fork hook.

> Well, in fact I want to code some console utility to get information from the 
> application (loaded configuration, check the database(s) connection and so).
> For that I was thinking in a DRb server running in the master because it must 
> bind in some TCP port.
DRb can bind to UNIX domain sockets, too.  But ask yourself:

  Is your app really so broken that you always need DRb running on it?

You may also want to checkout Hijack, I haven't used/needed it myself,
but it could be interesting if an app is really in a lot of trouble:


> The problem is that I should stop the DRb server before master reexec to avoid 
> EADDINUSE. Well, I could code some rescue block...

rescuing EADDRINUSE in a loop is also how the "listen" directive
implements the :tries/:delay parameters.

> >   $ rackup -h
> ...
> >  -D, --daemonize          run daemonized in the background
> Why "daemonize" is not present in unicornf configuration file?

Mainly it was cleaner and easier to test/implement it the way it is now.
It's also easier for somebody testing a setup to toggle it from the
command line.

I actually didn't want to support --daemonize at all since setsid(8),
is standard most GNU/Linux distros nowadays, but we support more than
just GNU/Linux.

> Really thanks a lot for all your help.

No problem.

Eric Wong

More information about the mongrel-unicorn mailing list