Hi, I''m trying to override Unicorn::HttpServer::Worker#proc_name method. For that, I''ve copied bin/unicorn with other name and added the following code before "Unicorn::Launcher.daemonize! if daemonize" line: module Unicorn class HttpServer class Worker def proc_name(tag) ... some proc name ... end end end end However it doesn''t work and workers still read the original method. I''ve also tryed by using "-r" option to load a library containing such modifications. I suspect what is happening: When Unicorn creates the forked workers each of them is a new process which performs "require ''unicorn''" so the workers don''t read my customizations. Am I right? If so, is there some way to achieve it? Thanks a lot. -- I?aki Baz Castillo <ibc at aliax.net>
El Mi?rcoles, 23 de Diciembre de 2009, I?aki Baz Castillo escribi?:> I suspect what is happening: When Unicorn creates the forked workers each > of them is a new process which performs "require ''unicorn''" so the > workers don''t read my customizations. Am I right? If so, is there some way > to achieve it?Humm, but now I''ve realized that "netstat" just gets the master process. Shouldn''t the master process read my changes? The "issue" occurs running unicorn in both foreground and background (daemonized). Thanks. -- I?aki Baz Castillo <ibc at aliax.net>
El Mi?rcoles, 23 de Diciembre de 2009, I?aki Baz Castillo escribi?:> Hi, I''m trying to override Unicorn::HttpServer::Worker#proc_name method.I want to do it because by default Unicorn processes are called as: unicorn worker[0] -E production -c unicorn.conf.rb config.ru Unfortunatelly netstat takes the last word and shows "config.ru": ~# netstat -putan | grep "0.0.0.0:8080" tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 31575/config.ru This is not very good for the case in which the user/admin wants to know in which port the process is listening so it does: ~# netstat -putan | grep "unicorn" and gets nothing. Of course this is more an issue of "netstat" and how it determines to display the process name. However I would like to override the way unicorn displays the process name (without changing unicorn code). Regards. -- I?aki Baz Castillo <ibc at aliax.net>
I?aki Baz Castillo <ibc at aliax.net> wrote:> Hi, I''m trying to override Unicorn::HttpServer::Worker#proc_name method. For > that, I''ve copied bin/unicorn with other name and added the following code > before "Unicorn::Launcher.daemonize! if daemonize" line: > > module Unicorn > class HttpServer > class Worker > def proc_name(tag) > ... some proc name ... > end > end > end > endHi, proc_name is in HttpServer, not Worker -- Eric Wong
El Mi?rcoles, 23 de Diciembre de 2009, Eric Wong escribi?:> I?aki Baz Castillo <ibc at aliax.net> wrote: > > Hi, I''m trying to override Unicorn::HttpServer::Worker#proc_name method. > > For that, I''ve copied bin/unicorn with other name and added the following > > code before "Unicorn::Launcher.daemonize! if daemonize" line: > > > > module Unicorn > > class HttpServer > > class Worker > > def proc_name(tag) > > ... some proc name ... > > end > > end > > end > > end > > Hi, proc_name is in HttpServer, not WorkerGreat! oh my god... I was trying everything and didn''t realize of that XDD Thanks a lot, it just works :) -- I?aki Baz Castillo <ibc at aliax.net>