Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add God script

  • Loading branch information...
commit 31c507f361b4e0619d39aaaa2cf545071fba6d72 1 parent 96ebc6a
@mkelly12 mkelly12 authored
Showing with 42 additions and 0 deletions.
  1. +5 −0 config.yml.test
  2. +37 −0 rock_paper_scissors.god
View
5 config.yml.test
@@ -0,0 +1,5 @@
+bot_screen_name: 'testrps'
+consumer_key: 'PBPVvujq5JjSnGwK5e54A'
+consumer_secret: 'wTzfUogQ23h8KRIUXNoq7uqnosdsnOPyBVumW38Zm8g'
+oauth_token: '427170329-Jg9m6pSuA8gGdjLV9mcyD3P7tmeBuvCFq8zyNbiz'
+oauth_token_secret: 'lDxaJRiAuDgmn81JALDsrVFRc9wwA4HsCuN10nioJUk'
View
37 rock_paper_scissors.god
@@ -0,0 +1,37 @@
+God.watch do |w|
+ w.name = "rock_paper_scissors"
+ w.interval = 30.seconds
+ w.start = "ruby rock_paper_scissors.rb start"
+ w.start_grace = 10.seconds
+ w.restart_grace = 10.seconds
+
+ w.start_if do |start|
+ start.condition(:process_running) do |c|
+ c.running = false
+ end
+ end
+
+ w.restart_if do |restart|
+ restart.condition(:memory_usage) do |c|
+ c.above = 300.megabytes
+ c.times = 2
+ end
+
+ restart.condition(:cpu_usage) do |c|
+ c.above = 90.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.minutes
+ c.transition = :unmonitored
+ c.retry_in = 10.minutes
+ c.retry_times = 5
+ c.retry_within = 30.minutes
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.