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.
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
On Tue, Dec 14, 2010 at 02:21:21AM +0900, Iain Barnett wrote:
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.
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
PS Being the author of servolux, my opinion is completely biased
···
On Dec 19, 2010, at 1:18 PM, Jeremy Hinegardner wrote:
On Tue, Dec 14, 2010 at 02:21:21AM +0900, Iain Barnett wrote:
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.