Daemons is a nice gem for writing background processes. Just call Daemons.daemonize when you are ready to detach.


Daemons likes to change your working directory to /, for no clear reason. My file accesses were silently failing, and this was why. Also, you can use the :ontop => true key to help debug a daemonized program. :ontop keeps the process in the foreground and leaves STDERR attached to the console.