Posterous
Arthur is using Posterous to post everything online. Shouldn't you?
3286618267_3db31c4cec_o_thumb
 

Arthur Chang

« Back to blog

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.

Mar 18, 2009
Garry Tan said...
The only thing that sucks is in Ruby 1.8.6 it leaks memory like crazy. =(
Mar 18, 2009
Arthur Chang said...
I've tried using REE, not entirely sure if the leaks are better. Have you ventured into Ruby Enterprise? Does it have the same issues?
Mar 18, 2009
Garry Tan said...
Been meaning to try REE, just haven't had time. I assume they should be patched in that. We still run it on 1.8.6 ad have to restart it every week since depending how many processes it has to restart, it can balloon to 300meg or more of memory used. Crazy.
 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     twitter