I start up an external process when I start my rails environment. I currently do this in config/environment.rb by forking a process and recording it''s process id in log/foo.pid, I''d like to kill that process when I close mongrel. Is there an API in mongrel for responding to the shutdown event? Or do I need to listen for the term signal and do my clean up that way? Thanks, Todd -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20061026/da45937b/attachment.html
On 10/26/06, Todd Fisher <todd.fisher at gmail.com> wrote:> I start up an external process when I start my rails environment. I > currently do this in config/environment.rb by forking a process and > recording it''s process id in log/foo.pid, I''d like to kill that process > when I close mongrel. Is there an API in mongrel for responding to the > shutdown event? Or do I need to listen for the term signal and do my clean > up that way?Todd, you *shouldn''t* be doing that. Hook mongrel when stopping will require hack into mongrel_rails script, and that will brake things when going from 1 process to a cluster. My suggestion will be using something like BackgrounDrb [1] and control the start / stop actions from a init.d script maybe, but not from rails or mongrel (what if it crash?) Regards,> > Thanks, > Todd > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >-- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi [1] http://backgroundrb.rubyforge.org/
On Thu, 26 Oct 2006 14:52:35 -0400 "Todd Fisher" <todd.fisher at gmail.com> wrote:> I start up an external process when I start my rails environment. I > currently do this in config/environment.rb by forking a process and > recording it''s process id in log/foo.pid, I''d like to kill that process > when I close mongrel. Is there an API in mongrel for responding to the > shutdown event? Or do I need to listen for the term signal and do my clean > up that way?Easiest thing would be an at_exit handler. Maybe something like this in a mongrel.conf: at_exit { # kill the thing } Then run it with: mongrel_rails start -e production -S mongrel.conf -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://safari.oreilly.com/0321483502 -- The Mongrel Book http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.