On Sun, Dec 07, 2003 at 09:06:17PM +0900, Samuel Kvarnbrink wrote:
> Hi,
> Does anyone here have an example on how to create a Ruby daemon that 
> runs as a session leader (without a controlling terminal)? I've tried 

As long as I've been using Linux, I'm embarraced to admit that I still
draw a blank on process groups and shell sessions..

> to accomplish that using fork and Process.setpgrp, but the only results 
> so far have been zombie processes or processes that exit when I close 
> the terminal. I'm quite new to Ruby so I guess that I've missed some 
> little detail somewhere... :)

Well, I've done a few, so I figured I'd write a class for proper
'daemonization'. I'll optionally create a pid file and a socket if you
want that. And as I've had some problems with crashes, it can fork
twice, having the first one watch over the next and reforking if it
exits with an error (or crashes). I should clean it up and post it on
RAA, but haven't quite gotten there yet. Give a shout if you'd like to
try it.

-- 
Thomas
beast / system-tnt.dk