PID is not regenerated when using "-P" and the master receives USR2

Eric Wong normalperson at yhbt.net
Thu Dec 31 16:41:04 EST 2009


Iñaki Baz Castillo <ibc at aliax.net> wrote:
> El Jueves, 31 de Diciembre de 2009, Iñaki Baz Castillo escribió:
> > El Jueves, 31 de Diciembre de 2009, Eric Wong escribió:
> > > Iñaki Baz Castillo <ibc at aliax.net> wrote:
> > > > El Jueves, 31 de Diciembre de 2009, Iñaki Baz Castillo escribió:

<snip>

> > > All command-line arguments are passed to the child process.  We capture
> > > the command-line as soon as possible before option parsing happens.
> > 
> > However I use a modified version of "unicorn" executable, which is the same
> > with just two differences:
> > 
> > - The name is different.
> > 
> > - The commandline "-c" and "rackup" are removed. Instead these values are
> > fixed and I set them into the executable script by adding:
> > 
> >   options[:config_file]  = "PATH_TO_UNICORN_CONFIG.rb"
> >   config                 = "PATH_TO_CONFIG.ru"
> > 
> > 
> > So to run as daemon I just type:
> > 
> >   ~# myapp -D -P /tmp/myapp.pid
> > 
> > 
> > Could it explain my issue? I see "/tmp/myapp.pid.oldbin" after USR2, but I
> > don't see a new "/tmp/myapp.pid".
> > 
> > 
> > Thanks a lot for your help.
> 
> 
> I've some issue somewhere as when sending the USR2 I see:
> 
>   INFO: executing ["/usr/local/bin/myapp"] (in /)
> 
> while it should be ["/usr/local/bin/myapp","-P","/tmp/myapp.pid","-D"]

You need to require 'unicorn/launcher' or 'unicorn' before you do any
option parsing to stash ARGV in a safe place.

You can also play with the Unicorn::HttpServer::START_CTX hash
and modify the :argv array value if needed...

-- 
Eric Wong


More information about the mongrel-unicorn mailing list