public
Description: An example of a stand-alone Ruby web filter
Clone URL: git://github.com/JackDanger/hacker_news.git
Search Repo:
hacker_news / init.god
100644 28 lines (25 sloc) 0.595 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
God.watch do |w|
  dir = File.expand_path(File.dirname(__FILE__))
  w.name = "hackernews"
  w.interval = 30.seconds
  w.uid = 'www'
  w.gid = 'www'
  w.start = "#{dir}/hackernews"
  w.start_if do |start|
    start.condition(:process_running) do |c|
      c.interval = 5.seconds
      c.running = false
    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