Class: Smartware::Driver::Watchdog::WatchdogDaemon

Inherits:
Object
  • Object
show all
Defined in:
lib/smartware/drivers/watchdog/watchdog_daemon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ WatchdogDaemon

Returns a new instance of WatchdogDaemon.



9
10
11
12
# File 'lib/smartware/drivers/watchdog/watchdog_daemon.rb', line 9

def initialize(config)
  @error = nil
  @config = config
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



7
8
9
# File 'lib/smartware/drivers/watchdog/watchdog_daemon.rb', line 7

def error
  @error
end

Instance Method Details

#modelObject



14
15
16
# File 'lib/smartware/drivers/watchdog/watchdog_daemon.rb', line 14

def model
  "watchdogd-controlled watchdog"
end

#reboot_modemObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/smartware/drivers/watchdog/watchdog_daemon.rb', line 22

def reboot_modem
  begin
    File.open(@config["pidfile"], "r") do |io|
      pid = io.read.to_i

      Process.kill :USR1, pid
    end

    @error = nil
  rescue => e
    Smartware::Logging.logger.warn "Watchdog communication error: #{e}"

    @error = Interface::Watchdog::WATCHDOG_NOT_AVAILABLE
  end
end

#versionObject



18
19
20
# File 'lib/smartware/drivers/watchdog/watchdog_daemon.rb', line 18

def version
  ""
end