Arthur Chang

God.rb with Non-Daemon Proccess (no pid file)

I was running orbited and activemq processes without any monitoring tools that would notify me of errors and to restart them if they ever went down.  I turned to God.rb, which monitors processes much like Monit, but in a really nice way.  It's also configured all in ruby so it's easy for a rails app.

One problem was that orbited nor activemq spits out a pid file by default.  In fact, I couldn't get orbited to put a pid file anywhere, even with pid.location configurations.  How the heck do I get God.rb to trac it?  Well I read a small snippet in the bible, I mean God.rb documentation, if it can be called that (it's so short):

Need to watch a script that doesn't have built in daemonization? No problem! God will daemonize and keep track of your process for you

Sweet!  So for all those trying to watch non-daemon processes, God.rb can do it.  Just don't specify the pid file, and it will store it in a default location that you don't need to worry about.  If you do need access to the pid file, for situations like stopping by killing the process using the pid, you can also give God.rb a different pid storage location by including the following at the top of your config:

God.pid_file_directory = '/home/tom/pids'

Checkout the God.rb docs for more information about it.  Just wanted to give you guys a heads up in case you ever came across this issue.

Tagged  //   code   daemon   god   god.rb   pid