1 RAILS_ROOT = "/Users/tom/dev/gravatar2"
5 w.interval = 5.seconds # default
6 w.start = "mongrel_rails start -c #{RAILS_ROOT} -P #{RAILS_ROOT}/log/mongrel.pid -p 3000 -d"
7 w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.pid"
8 w.restart = "mongrel_rails restart -P #{RAILS_ROOT}/log/mongrel.pid"
9 w.pid_file = File.join(RAILS_ROOT, "log/mongrel.pid")
11 # clean pid files before start if necessary
12 w.behavior(:clean_pid_file)
14 # determine the state on startup
15 w.transition(:init, { true => :up, false => :start }) do |on|
16 on.condition(:process_running) do |c|
21 # determine when process has finished starting
22 w.transition([:start, :restart], :up) do |on|
23 on.condition(:process_running) do |c|
28 on.condition(:tries) do |c|
34 # start if process is not running
35 w.transition(:up, :start) do |on|
36 on.condition(:process_exits)
39 # restart if memory or cpu is too high
40 w.transition(:up, :restart) do |on|
41 on.condition(:memory_usage) do |c|
43 c.above = 50.megabytes
47 on.condition(:cpu_usage) do |c|
56 on.condition(:flapping) do |c|
57 c.to_state = [:start, :restart]
60 c.transition = :unmonitored
61 c.retry_in = 10.minutes
63 c.retry_within = 2.hours