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. Which is the real advantage of using "pid" directive in config file rather than "--pid"? Thanks. -- I?aki Baz Castillo <ibc at aliax.net>
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
El Jueves, 24 de Diciembre de 2009, Eric Wong escribi?:> > 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.Ubuntu upstart system (now also adopted by Debian) is a great improvement over classic init system as it behaves as a daemon which already knows the PID number used for each service (so it doesn''t need to look for it in a file). However I haven''t experiment with upstart yet.> Using ENV["UNICORN_PID"] could be an option in the config file if you > want to share it between the config and init script.The problem is that config file is usually a XML/INI/YAML/Ruby file, while a common init script is writen in Bash (99% of times), so reading a config parameter from the init script involves dirty parsing and so... :( Well, I agree that using PID file is ugly and not cool at all, but it''s widely used and it''s what we have now :) -- I?aki Baz Castillo <ibc at aliax.net>