2

I have a Ruby 1.9 script that I want to run as a long-running background process.

It looks like I have a choice between calling Process.daemon inside the script to daemonize it, or I can just run the script in the background using a shell's ampersand and keep it running after I log out of the server by prefixing the command with nohup.

Which way is better?

dan
  • 43,914
  • 47
  • 153
  • 254

1 Answers1

4

Process.daemon seems like a more clean and straightforward way, especially if this is something you would ever way to turn into a full-fledged daemon that is started during boot.

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284