Skip to content

Instantly share code, notes, and snippets.

@boris
Created March 3, 2014 15:48
Show Gist options
  • Save boris/9327786 to your computer and use it in GitHub Desktop.
Save boris/9327786 to your computer and use it in GitHub Desktop.
mysql godrb (http://godrb.com/) config file
God.watch do |w|
w.name = "mysql"
w.interval = 30.seconds
w.start = "/etc/init.d/mysql start"
w.stop = "/etc/init.d/mysql stop"
w.restart = "/etc/init.d/mysql restart"
w.start_grace = 20.seconds
w.restart_grace = 20.seconds
w.pid_file = "/var/run/mysqld/mysqld.pid"
w.behavior(:clean_pid_file)
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
on.condition(:tries) do |c|
c.times = 8
c.within = 2.minutes
c.transition = :start
end
end
#Start if not running
w.transition(:up, :start) do |on|
on.condition(:process_exits)
end
w.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 1.minute
c.transition = :unmonitored
c.retry_in = 3.minutes
c.retry_times = 5
c.retry_within = 2.hours
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment