On 13 Dec 2010, at 17:44, Alex Young wrote:

> 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/.


Thanks Alex, I'll give both that gem and the code a good look!

Regards,
Iain
>