I have had some great success monitoring three seaside images serving an email application. I thought I would share the script as it offers more features than using daemontools and I have been using ruby god for years now so I am quite comfortable with its stability. Ruby God: http://godrb.com My application admin.ses.sg.estormtech.com/ficonabemail My god script. changes directory to the image directory [seaside_root] monitors http, memory usage and cpu usage and restarts its. send an email if this happens. If you want the contact script, just drop me an email. (the c.notify below). (You can also find it on github) Scott - i receive an email when the image has to be restarted similar to below... Message: seaside2 [trigger] process 11692 exited {:exit_code=>6, :pid=>11692, :thread_group_id=>11692, :exit_signal=>17} (ProcessExits) Host: xxxxxx Priority: Category: SEASIDE_GROUPS ={:seaside1=> {},:seaside2=>{}, :seaside3=>{} } SEASIDE_GROUPS[:seaside1]={:group => "seaside1",:seaside_root => "/var/sites/xxxx/", :ports => [8083,8084], :image => "xxx.image"} SEASIDE_GROUPS[:seaside2]={:group => "seaside2",:seaside_root => "/var/sitesyyyy/", :ports => [8088,8089,8090], :image => "yyy.image"} SEASIDE_GROUPS[:seaside3]={:group => "seaside3",:seaside_root => "/var/sites/zzz/", :ports => [8092,8093,8094], :image => "zzz.image"} SEASIDE_GROUPS.each { |key,grp| puts "starting #{grp[:group]} root: #{grp[:seaside_root]} ports: #{grp[:ports].join(',')} image: #{grp[:image]} }" God.watch do |w| w.name = "#{grp[:group]}" w.group = "seaside" w.interval = 30.seconds w.dir = grp[:seaside_root] w.log = "/var/sites/godlog/#{grp[:group]}.log" w.start = "/usr/bin/CogVM -mmap 256m -vm-sound-null -vm-display-null #{grp[:image]}" # VM="/usr/bin/CogVM" # VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null" # IMAGE="sesbase.image" # w.uid = 'www-data' # w.gid = 'www-data' w.uid = 'root' # w.gid = 'www-data' # retart if memory gets too high w.transition(:up, :restart) do |on| on.condition(:memory_usage) do |c| c.above = 350.megabytes c.times = 2 end on.condition(:cpu_usage) do |c| c.interval = 10 c.above = 40.percent c.times = 8 end grp[:ports].each { |port| puts "http checking: #{port} on #{grp[:group]} " on.condition(:http_response_code) do |c| c.host = 'localhost' c.port = port c.path = '/ficonabemail' c.code_is = 400 # c.interval = 30 c.timeout = 7.seconds c.times = [3, 5] end } end # determine the state on startup w.transition(:init, { true => :up, false => :start }) do |on| on.condition(:process_running) do |c| c.running = true end end # determine when process has finished starting w.transition([:start, :restart], :up) do |on| on.condition(:process_running) do |c| c.running = true c.interval = 5.seconds end # failsafe on.condition(:tries) do |c| c.times = 5 c.transition = :start c.interval = 5.seconds end end # start if process is not running w.transition(:up, :start) do |on| on.condition(:process_running) do |c| c.running = false end on.condition(:process_exits) do |c| c.notify = 'scott' end end end }