added MemoryUsage and factored out ProcessCondition
[god.git] / test / configs / real.rb
blobced8948628ac8d70dc576c07a179df9ec65a48c1
1 if $0 == __FILE__
2   require File.join(File.dirname(__FILE__), *%w[.. .. lib god])
3 end
5 RAILS_ROOT = "/Users/tom/dev/gravatar2"
7 God.meddle do |god|
8   god.interval = 5 # seconds
9   
10   god.watch do |w|
11     w.name = "gravatar2-mongrel-3000"
12     w.cwd = RAILS_ROOT
13     w.start = "mongrel_rails start -P ./log/mongrel.pid -d"
14     w.stop = "mongrel_rails stop -P ./log/mongrel.pid"
15     w.grace = 5
16     
17     pid_file = File.join(RAILS_ROOT, "log/mongrel.pid")
18   
19     w.start_if do |start|
20       start.condition(:process_not_running) do |c|
21         c.pid_file = pid_file
22       end
23     end
24     
25     w.restart_if do |restart|
26       restart.condition(:memory_usage) do |c|
27         c.pid_file = pid_file
28         c.above = 10 # kb
29         c.times = [3, 5]
30       end
31     end
32   end
33 end