From: Kyle Schmitt Date: 2009-02-18T11:20:24+09:00 Subject: Re: a little daemon daemonizes, but hangs the logout On Tue, Feb 17, 2009 at 5:38 PM, Joel VanderWerf wrote: >> I needed a little daemon thisafternoon, so I wrote one in ruby using >> fork and Process.detach. It's working ok I suppose, except that when > > IIUC, Process.detach is not what you need to start a daemon. All it does is > start a ruby thread to reap the pid when the child exits, so you don't end > up with zombies. If the parent process exits first, this thread is gone > anyway. > > Search the list for daemonize... for a classic daemon, you need to double > fork, Process.setsid, chdir, disconnect from stdin/out, and probably > something else I'm forgetting. > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 Ahh ok. It's been so long since I've written a classic daemon in C, that when I saw a post using Process.detach I thought, wow, ruby really _does_ make everything so easy ;) I'll go read, and go the classic route. Daemonize is probably a fine nice library, but being for work, issues sometimes arise about which extra packages are put on a server. Gobs of home-grown code are fine, third party apps and libs are _sometimes_ frowned upon. Just one of those things. Thanks --Kyle