Hi, This is likely because monit nukes the majority of the environment variables for security reasons (including the path)
See http://www.tildeslash.com/monit/doc/faq.php (Q6) for more info. Easiest way around it is to call mongrel_rails from a shell script that sets the environement beforehand. - Paul On 27/02/07, Jack Baty <[EMAIL PROTECTED]> wrote: > On one of my development servers mongrel dies when idle for any length > of time. Since I've not been able to solve that problem I thought I'd > route around it by using monit to kick things when necessary. > > My monitrc contains the following... > > -------------------------------------------------------------------------------- > check process mongrel_8310 with pidfile > /home/valleyc/apps/cms/dev/current/log/mongrel.8310.pid > group mongrel > start program = "/usr/local/bin/mongrel_rails cluster::start -C > /home/valleyc/apps/cms/dev/current/config/mongrel_cluster.yml --clean > --only 8310" > stop program = "/usr/local/bin/mongrel_rails cluster::stop -C > /home/valleyc/apps/cms/dev/current/config/mongrel_cluster.yml --clean > --only 8310" > > if failed host 127.0.0.1 port 8310 protocol http > with timeout 10 seconds > then restart > > if totalmem > 128 Mb then restart > if cpu is greater than 60% for 2 cycles then alert > #if cpu > 90% for 5 cycles then restart > #if loadavg(5min) greater than 10 for 8 cycles then restart > if 3 restarts within 5 cycles then timeout > -------------------------------------------------------------------------------- > > If I run the start command manually it works fine. When run via monit > however it seems unable to find mongrel_rails.... > > # monit validate > 'mongrel_8310' process is not running > 'mongrel_8310' trying to restart > 'mongrel_8310' start: /usr/local/bin/mongrel_rails > 'mongrel_8310' failed to start > starting port 8310 > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27: > command not found: mongrel_rails start -d -e production -a 127.0.0.1 > -c /home/valleyc/apps/cms/dev/current --user valleyc --group valleyc > -p 8310 -P /home/valleyc/apps/cms/dev/current/log/mongrel.8310.pid -l > log/mongrel.8310.log > > No amount of $PATH fiddling seemed to help, so for now I've patched > mongrel_cluster's init.rb by changing line 62 (of version 1.0.1.1) > from this... > > argv = [ "mongrel_rails" ] > > to this... > > argv = [ "/usr/local/bin/mongrel_rails" ] > > ...which works, but seems less than ideal. Any suggestions for a > better way to fix this without messing with the mongrel_cluster code > would be appreciated. > > Thanks, > > Jack > > -- > -------------------------------------------------------------------------------- > Jack Baty http://jackbaty.com/ (616) 822-5800 > Fusionary http://fusionary.com/ (616) 454-2357 > 820 Monroe N.W. Suite 212 > Grand Rapids, MI 49503 > _______________________________________________ > Mongrel-users mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/mongrel-users > _______________________________________________ Mongrel-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-users
