Search code examples
rubymonitordaemons

Ruby daemons - what is a monitor and how does it work?


So Ruby's daemons gem lets you set monitor=true when you start up your process. What the heck is a monitor and what do you do with it? All you do is specify true or false...is that creating a log file somewhere? Something that is actually monitoring the process, like god? Why is the documentation on what this thing is so horrible?

Or is this actually a Unix thing that everyone is supposed to know about? :)


Solution

  • From the fine manual:

    :monitor: Monitor the programs and restart crashed instances.

    Looks like it sets up a PID file (i.e. a file holding the daemon's process ID) to track the daemon; if the daemon crashes for some reason, the monitor will restart it.

    You'll have to ask the authors why their documentation is so sparse; the source code looks clear enough to the gist of what's going on though. I'd think that anyone that has built a daemon or two would be familiar with the concept of monitoring and restarting them.