Class: SAAL::Daemon
- Inherits:
-
Object
- Object
- SAAL::Daemon
- Defined in:
- lib/daemon.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Daemon
constructor
A new instance of Daemon.
- #run ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Daemon
Returns a new instance of Daemon.
53 54 55 |
# File 'lib/daemon.rb', line 53 def initialize(opts={}) @opts = opts end |
Instance Method Details
#run ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/daemon.rb', line 57 def run ForkedRunner.run_as_fork(@opts) do |forked_runner| @sensors = SAAL::Sensors.new(@opts[:sensorconf], @opts[:dbconf]) @interval = @opts[:interval] || 60 begin @sensors.each {|sensor| sensor.store_value} forked_runner.sleep @interval end while !forked_runner.stop? end end |