I tried for quite a few hours in vain to use the Daemons module for Rails. Ultimately, Rails was always trying to write to STDOUT and that is not allowed for real daemons. No matter where I reopened STDOUT to write to a file, Rails always seemed to have a reference to the closed one. Anyway, so I ended up writing my own daemon process. It works, but still remains connected to the shell, so that when I exit, I need to kill my ssh session. The daemon still runs, but it''s annoying. Here is my code. I tried to emulate what Daemons is supposed to do, but of course I don''t do everything (e.g. I don''t set the umask, etc.). Does anyone have any idea why this would remain attached to the tty? Regardless, I think this code is probably helpful to people. Thanks. if (@@DAEMON) puts "Running as daemon. Output in " + ENV["PWD"] + "/log" $stdout = STDOUT.reopen("log/import-stdout.log", "w") $stderr = STDERR.reopen("log/import-stderr.err", "w") pid = fork if pid Process.detach(pid) exit else Process.setsid pid = fork if pid Process.detach(pid) exit end end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---