Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2012 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3090939 to your computer and use it in GitHub Desktop.
Save anonymous/3090939 to your computer and use it in GitHub Desktop.
#### lib file
def lifecycle(times, within, retry_in, retry_times, retry_within)
Proc.new do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = times
c.within = within.minute
c.transition = :unmonitored
c.retry_in = retry_in.minutes
c.retry_times = retry_times
c.retry_within = retry_within.hours
end
end
end
####god file
#eval(File.open('lib.rb').read)
#require lib
#load lib
God.watch do |solr|
solr.name = "solr"
solr.start = "/etc/init.d/solr start"
solr.stop = "/etc/init.d/solr stop"
solr.restart = "/etc/init.d/solr restart"
solr.pid_file = "/var/run/solr-3.6.0.pid"
solr.behavior(:clean_pid_file)
solr.lifecycle(&lifecycle(5,5,10,5,2))
end
###error
wrong number of arguments (1 for 0)
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god.rb:682:in `start'
/etc/god/conf.d/solr.god:10:in `block in root_binding'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god.rb:284:in `task'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god.rb:271:in `watch'
/etc/god/conf.d/solr.god:1:in `root_binding'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god.rb:576:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god.rb:576:in `running_load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/god-0.12.1/lib/god/socket.rb:58:in `method_missing'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment