Skip to content

Instantly share code, notes, and snippets.

@azisaka
Created October 6, 2008 19:45
Show Gist options
  • Save azisaka/15115 to your computer and use it in GitHub Desktop.
Save azisaka/15115 to your computer and use it in GitHub Desktop.
God.watch do |w|
w.name = "apache"
w.start = "apache2ctl -k start"
w.stop = "apache2ctl -k stop"
w.restart = "apache2ctl -k restart"
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 10.seconds
c.running = false
end
end
w.restart_if do |restart|
restart.condition(:cpu_usage) do |c|
c.above = 20.percent
c.interval = 1.seconds
c.times = 5
end
restart.condition(:memory_usage) do |c|
c.above = 512.megabytes
c.interval = 1.seconds
c.times = 5
end
end
end
3.times do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment