tags:

views:

22

answers:

1

I would like to write a Ruby script that runs a daemon Ruby process, so that I can do something like the following:

$ task start
Started...

# start a daemon to do useful work; don't block

# Some time later:
$ task end
Finished.

What's the best way to go about this?

+1  A: 

Use the Process.daemon method when you want your process to detach from the terminal and stop being able to send output. To end the process, you will have to send it a signal. Most programs handle this by using a file that contains the PID.

Adrian