Backgrounding a process in ruby is easy, just add
Process.daemon
This works great but by doing so you will actually lose any output since daemon
will redirect stdout and stderr to /dev/null by default. Depending on how you
handle logging this might actually not be a great idea, I personally prefer
redirecting the output of a daemon process myself so I can add logging easily.
This is easily solve so by passing both parameters for daemon, first to either
do or don’t change the working dir to / and the second to not redirect stdout
and stderr.
Process.daemon true, true
Just a nice thing which is quickly overlooked.