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

Iñaki Baz Castillo ibc at
Thu Dec 31 15:40:50 EST 2009

El Jueves, 31 de Diciembre de 2009, Eric Wong escribió:
> Iñaki Baz Castillo <ibc at> wrote:
> > El Jueves, 31 de Diciembre de 2009, Iñaki Baz Castillo escribió:
> > > In case of using "unicorn -P PIDFILE" when the master receives a USR2
> > > the pidfile is deleted and not regenerated anymore.
> > >
> > > In case of using "pid" mehotd in config file then it works well.
> > >
> > > It seems a bug, do I miss something?
> >
> > Definitively I think this is the expected behaviour as the new binary has
> > no way to know the PIDFILE passed as commandline argument to original
> > binary, am I right?
> All command-line arguments are passed to the child process.  We capture
> the command-line as soon as possible before option parsing happens.
> When USR2 is received, we create a new pid file for the old
> binary and add the ".oldbin" suffix to the pathname.
> That said, "-P" in the command-line and "pid" in the config file should
> work the same.  Despite being officially deprecated, "-P" is used
> extensively and interchangeably with "pid" in the existing tests.

Yes, I confirm that using pure "unicorn" command with "-P" it works (both 
"" and "" exist after USR2).

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                 = ""

So to run as daemon I just type:

  ~# myapp -D -P /tmp/

Could it explain my issue? I see "/tmp/" after USR2, but I 
don't see a new "/tmp/".

Thanks a lot for your help.

Iñaki Baz Castillo <ibc at>

More information about the mongrel-unicorn mailing list