-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stop_signal and stop_timeout options; fix stop string command not…
… working
- Loading branch information
Showing
6 changed files
with
80 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /usr/bin/env ruby | ||
|
||
trap :USR1 do | ||
|
||
end | ||
|
||
loop do | ||
STDOUT.puts('server'); | ||
STDOUT.flush; | ||
|
||
sleep 10 | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
God.watch do |w| | ||
w.name = 'stop-options' | ||
w.start = File.join(GOD_ROOT, *%w[test configs stop_options simple_server.rb]) | ||
w.stop_signal = 'USR1' | ||
w.stop_timeout = 5 | ||
w.interval = 5 | ||
w.grace = 2 | ||
|
||
w.start_if do |start| | ||
start.condition(:process_running) do |c| | ||
c.running = false | ||
end | ||
end | ||
|
||
w.restart_if do |restart| | ||
restart.condition(:cpu_usage) do |c| | ||
c.above = 30.percent | ||
c.times = [3, 5] | ||
end | ||
|
||
restart.condition(:memory_usage) do |c| | ||
c.above = 10.megabytes | ||
c.times = [3, 5] | ||
end | ||
end | ||
|
||
# lifecycle | ||
w.lifecycle do |on| | ||
on.condition(:flapping) do |c| | ||
c.to_state = [:start, :restart] | ||
c.times = 3 | ||
c.within = 60.seconds | ||
c.transition = :unmonitored | ||
c.retry_in = 10.seconds | ||
c.retry_times = 2 | ||
c.retry_within = 5.minutes | ||
end | ||
end | ||
end |