From: James Gray Date: 2009-04-25T04:11:41+09:00 Subject: Re: proper way to daemonize On Apr 24, 2009, at 2:07 PM, Tim Pease wrote: > On Fri, Apr 24, 2009 at 12:46 PM, Eric Hodel > wrote: >> On Apr 24, 2009, at 08:11, Tim Pease wrote: >>> >>> # ... >>> >>> This is the standard code to daemonize a process. The use of "exit" >>> bothers me slightly, as it will call all "at_exit" handlers in the >>> parent. I do not believe this is the desired behavior; the "at_exit" >>> handlers will free resources that the daemonized process might need. >>> Instead, "exit!" should be used to prevent "at_exit" handlers from >>> being called. >>> >>> Any thoughts about this subtle change? Are there any undesirable >>> side >>> effects that arise from using exit! instead of exit ? >> >> Why not just: >> >> require 'webrick/server' >> >> WEBrick::Dameon.start >> >> It has exit! and all that built-in. >> > > Eric, if I had half your brain I'd be twice as smart. Didn't even > think to look through the stdlibs. As of Ruby 1.9 Process.daemon() is a core method. Just one more reason 1.9 rocks. :) James Edward Gray II