Why "--pid" is deprecated?

Eric Wong normalperson at yhbt.net
Thu Dec 24 14:17:35 EST 2009

Iñaki Baz Castillo <ibc at aliax.net> wrote:
> By inspecting bin/unicorn I've realized that "--pid" file exists but it's 
> deprecated:
>   opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
>     warn %q{Use of --pid/-P is strongly discouraged}
>     warn %q{Use the 'pid' directive in the Unicorn config file instead}
>     options[:pid] = f
>   end
> Could I know why? In order to build a service init script is really common the 
> init script to handle the PID file so it can start, restart or stop the 
> process runnining under that PID value.

Hi Iñaki,

It conflicts/confuses the -P/--path setting in bin/unicorn_rails.  An
oversight on my part since I based unicorn_rails on script/server
in Rails.  So I suppose we're stuck with it for a while.

> Which is the real advantage of using "pid" directive in config file rather 
> than "--pid"?

Not much, pid files suck either way.  Sadly there aren't many other
options that's universally used/accepted.

Using ENV["UNICORN_PID"] could be an option in the config file if you
want to share it between the config and init script.

Eric Wong

More information about the mongrel-unicorn mailing list