# Monit fails to start|stop mongrel\_rails

**URL:** <https://www.ruby-forum.com/t/monit-fails-to-start-stop-mongrel-rails/139801>\
**Category:** Rails\
**Created:** [June 7, 2008, 6:10am UTC](https://www.ruby-forum.com/t/monit-fails-to-start-stop-mongrel-rails/139801 "2008-06-07T06:10:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ccd318/32.png) [@jbb](https://www.ruby-forum.com/u/jbb)\
**Post date:** [June 7, 2008, 6:10am UTC](https://www.ruby-forum.com/t/monit-fails-to-start-stop-mongrel-rails/139801/1 "2008-06-07T06:10:52Z")

</div>

I’m battling with Monit on Debian Etch and need some help. I’ve  
included the mongrel.monitrc file I’m using. If you issue the start  
program and stop program commands shown in that file from the command  
line, they work fine, regardless of what directory you issue them  
from. Interestingly, calling “monit status” does show that the  
test3\_8001 process is being monitored and shows the correct statistics  
for uptime, etc. However, when you run “monit restart test3\_8001”  
there is a failure. “monit status” eventually shows “Execution  
failed” as a status for test3\_8001, but does continue to show all the  
other correct stats as before. Checking the monit\_errors.log shows  
only the following:  
488 [PDT Jun 6 20:56:22] info : ‘mongrel\_test3\_8001’ trying to  
restart  
489 [PDT Jun 6 20:56:22] info : ‘mongrel\_test3\_8001’ start: /usr/  
bin/env  
490 [PDT Jun 6 20:56:23] error : ‘mongrel\_test3\_8001’ failed to  
stop

Other notes:

- Paths  
—\> I tried just having the /usr/local/lib/site\_ruby/gems/bin/  
mongrel\_rails cluster::start -C /home/jay/test/testing/config/  
mongrel\_cluster.yml --clean --only 8001" as a path  
—\> I also tried adding the path to the ruby executable which is /usr/  
local/bin/ruby on my machine prior to the above.

the mongrel.monitrc file:

check process test3\_8001  
with pidfile /home/jay/test/testing/tmp/pids/mongrel.8001.pid  
start program = “/usr/bin/env PATH=$PATH:/usr/local/lib/site\_ruby/  
gems/bin /usr/local/lib/site\_ruby/gems/bin/mongrel\_rails  
cluster::start -C /home/jay/test/testing/config/mongrel\_cluster.yml –  
clean --only 8001”  
stop program = “//usr/bin/env PATH=$PATH:/usr/local/lib/site\_ruby/  
gems/bin /usr/local/lib/site\_ruby/gems/bin/mongrel\_rails cluster::stop  
-C /home/jay/test/testing/config/mongrel\_cluster.yml --only 8001”

# if cpu \> 60% for 2 cycles then alert

if cpu \> 80% for 4 cycles then restart  
if totalmem \> 110.0 MB for 4 cycles then restart

# if children \> 250 then restart

# if loadavg(5min) greater than 10 for 8 cycles then stop

# if failed host [www.tildeslash.com](http://www.tildeslash.com) port 80 protocol http

# and request “/monit/doc/next.php”

# then restart

# if failed port 443 type tcpssl protocol http

# with timeout 15 seconds

# then restart

if 20 restarts within 20 cycles then timeout

# depends on apache\_bin

group test\_mongrels

Thanks for any thoughts - I’m at a loss…

JBB

---

<div class="post-metadata">

**Author:** ![jbb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ccd318/32.png) [@jbb](https://www.ruby-forum.com/u/jbb)\
**Post date:** [June 7, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/monit-fails-to-start-stop-mongrel-rails/139801/2 "2008-06-07T22:35:32Z")

</div>

The answer for me at long last was to set GEM\_HOME in the  
mongrel.monitrc file. So  
start program = "env GEM\_HOME= /usr/local/bin/  
mongrel\_rails cluster::start -C …
