Explanation of how Unicorn returns error code when daemonized and cannot bind the address

Iñaki Baz Castillo ibc at aliax.net
Thu Apr 15 13:46:08 EDT 2010


2010/4/15 Iñaki Baz Castillo <ibc at aliax.net>:
> Hi Eric, as you remember you did an improvement in Unicorn in order it
> to return an error code (maybe 1) when running daemonized and trying
> to bind in a wrong address (i.e. a non local address).
>
> As far as I remember you implemented a pipe between daemon and master
> process, so if the master returns error it sends such result to the
> daemon process and it also ends with error. This is more than useful
> and required when handling init script with HeartBeat and similar
> software in which the return code of the init script must be correct
> (it just can return 0 if it has started correctly).
>
> If I'm wrong, could you detail it a bit please? I want to propose the
> same improvement in other project in which I participate.

Well, I've rechecked the code and it seems simple: the grandparent
process wait listening into the pipe. The master process would write
in the pipe if all goes ok, then grandparent would exit with 0. If the
master process fails it closes the pipe, the grandparent detects it
and exits with 1 (error)  :)


-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the mongrel-unicorn mailing list