Created
November 16, 2012 20:18
-
-
Save mitchty/4090533 to your computer and use it in GitHub Desktop.
dumb god config for my irc stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First startup znc prior to the alice daemon | |
| God.watch do |w| | |
| w.name = 'znc-daemon' | |
| w.interval = 30.seconds # default | |
| w.start = 'znc' | |
| w.stop = 'pkill znc' | |
| w.start_grace = 10.seconds | |
| w.restart_grace = 10.seconds | |
| w.pid_file = ENV['HOME'] + '/.znc/znc.pid' | |
| w.log = ENV['HOME'] + '/god/log/znc.log' | |
| w.start_if do |start| | |
| start.condition(:process_running) do |c| | |
| c.interval = 5.seconds | |
| c.running = false | |
| end | |
| end | |
| w.restart_if do |restart| | |
| restart.condition(:memory_usage) do |c| | |
| c.above = 150.megabytes | |
| c.times = [3, 5] # 3 out of 5 intervals | |
| end | |
| restart.condition(:cpu_usage) do |c| | |
| c.above = 50.percent | |
| c.times = 5 | |
| end | |
| end | |
| w.lifecycle do |on| | |
| on.condition(:flapping) do |c| | |
| c.to_state = [:start, :restart] | |
| c.times = 5 | |
| c.within = 5.minute | |
| c.transition = :unmonitored | |
| c.retry_in = 10.minutes | |
| c.retry_times = 5 | |
| c.retry_within = 2.hours | |
| end | |
| end | |
| end | |
| # And then alice | |
| God.watch do |w| | |
| w.name = 'alice-daemon' | |
| w.interval = 30.seconds # default | |
| w.start = ENV['HOME'] + '/alice/bin/alice -a 0.0.0.0 -d 0' | |
| w.stop = 'pkill aliced' | |
| w.start_grace = 10.seconds | |
| w.restart_grace = 10.seconds | |
| w.log = ENV['HOME'] + '/god/log/alice.log' | |
| w.start_if do |start| | |
| start.condition(:process_running) do |c| | |
| c.interval = 5.seconds | |
| c.running = false | |
| end | |
| end | |
| w.restart_if do |restart| | |
| restart.condition(:memory_usage) do |c| | |
| c.above = 150.megabytes | |
| c.times = [3, 5] # 3 out of 5 intervals | |
| end | |
| restart.condition(:cpu_usage) do |c| | |
| c.above = 75.percent | |
| c.times = 5 | |
| end | |
| end | |
| w.lifecycle do |on| | |
| on.condition(:flapping) do |c| | |
| c.to_state = [:start, :restart] | |
| c.times = 5 | |
| c.within = 5.minute | |
| c.transition = :unmonitored | |
| c.retry_in = 10.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