I thought this was pretty clever if you're using the slingshot
library, or even the railsmachine (I think with maybe a modified
mongrel_start_port variable):


desc "Setup monit daemon monitoring"
task :setup_monit do

  monit_configuration = render :template => <<-EOF
# This monit configuration was generated dynamically
#
EOF

  (0..mongrel_servers-1).each do |server|
    monit_configuration +=<<-EOF
check process mongrel-#{mongrel_start_port + server} with pidfile
#{deploy_to}/current/log/mongrel.#{mongrel_start_port + server}.pid
  group mongrel
  start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails
start -d -e production -p #{mongrel_start_port + server} -a 127.0.0.1
-l #{deploy_to}/current/log/mongrel.log -P
#{deploy_to}/shared/log/mongrel.#{mongrel_start_port + server}.pid -c
#{deploy_to}/current"
  stop program  = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails
stop -P #{deploy_to}/shared/log/mongrel.#{mongrel_start_port +
server}.pid"
  if totalmem > 100.0 MB for 5 cycles then restart
  if failed port #{mongrel_start_port + server} protocol http with
timeout 10 seconds then restart

EOF
  end

  put monit_configuration, "/etc/monit.d/rails.conf"

end


-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com
main: 678.389.9462  fax: 678.826.0969

Ruby on Rails Bootcamp at the Big Nerd Ranch
Intensive Ruby on Rails Training:
http://www.bignerdranch.com/classes/ruby.shtml

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to