From: Alex Young Date: 2010-12-14T02:44:33+09:00 Subject: Re: Daemons Iain Barnett wrote in post #968104: > Hi, > > I've got a process I'd like to daemonize, a call the twitter search API > ever 10 minutes or so. There seem to be a few gems that purport to make > this process easier and I was wondering if anyone could recommend (or > tell me to avoid) any? Or just any tips to watch out for. > The Daemons gem is good, but if you don't need anything fancy then it's not much code to do it yourself: # File lib/webrick/server.rb, line 28 def Daemon.start exit!(0) if fork Process::setsid exit!(0) if fork Dir::chdir("/") File::umask(0) STDIN.reopen("/dev/null") STDOUT.reopen("/dev/null", "w") STDERR.reopen("/dev/null", "w") yield if block_given? end -- Alex -- Posted via http://www.ruby-forum.com/.