If you're using Monit to restart a Mongrel cluster, you'll probably run into the problem detailed here - that is, Monit reports "execution failed" when trying to restart a mongrel instance. The problem is that mongrel_rails is usually in /usr/local/bin/, and Monit doesn't put /usr/local/bin in the PATH. That blog post's comments have a variety of suggestions and you'll find similar ideas around the web, such as:
- Edit
/usr/local/bin/mongrel_railsand mungeENV['PATH'] - Uglify the Monit script's
start_programto call/usr/bin/env PATH=/usr/local/bin - Symlink
/usr/bin/mongrel_railsto/usr/local/bin/mongrel_rails
That last suggestion seems fairly painless... but still clumsy.
So, here's another way. Are you compiling monit from source? Good! Edit env.c and change line 158:
/* BEFORE */ char *path = "PATH=/bin:/usr/bin:/sbin:/usr/sbin"; /* AFTER */ char *path = "PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin";
A quick make && sudo make install and there you go! /usr/local/bin is now on the PATH. Enjoy!
Oh, sure, NOW you tell me. Where were you 6 months ago when I had this problem on my blog? ;-)
Posted by: Lori M Olson | August 22, 2009 at 04:19 PM
@lori, indeed, that's a murphy's law variant, I think. And if I don't blog this stuff I'll have forgotten it myself next time I need it!
Posted by: tomcopeland | August 23, 2009 at 10:19 PM