class RhaDaemon
RhaDaemon
controls the heartbeat daemon
Attributes
Increment debugging level. Higher levels are more verbose.
Set heartbeat daemon option; This will set an arbitrary heartbeat option.
Alternate path to heartbeat. If this is not set, environment path is used.
Public Class Methods
Returns a new RhaDaemon
Object
# File lib/rha/daemon.rb, line 37 def initialize() end
Public Instance Methods
Reload heartbeat. This option is functionally identical to sending a running heartbeat process a HUP signal. If the configuration has not changed, then this option is essentially a no-op. If ha.cf or authkeys has changed, then heartbeat will re-read these files and update its configuration.
# File lib/rha/daemon.rb, line 47 def reload tmp = Tempfile.new('tmp') command = option_string() + "-r " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Report heartbeat status.
# File lib/rha/daemon.rb, line 93 def report tmp = Tempfile.new('tmp') command = option_string() + "-k " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Heartbeat restart exec flag (internal use only).
# File lib/rha/daemon.rb, line 116 def restart tmp = Tempfile.new('tmp') command = option_string() + "-R " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Heartbeat current resource state for restart (internal use only).
# File lib/rha/daemon.rb, line 162 def restart_with_current_resources tmp = Tempfile.new('tmp') command = option_string() + "-R -C " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Report heartbeat status.
# File lib/rha/daemon.rb, line 139 def status tmp = Tempfile.new('tmp') command = option_string() + "-s " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Kill (stop) heartbeat.
# File lib/rha/daemon.rb, line 70 def stop tmp = Tempfile.new('tmp') command = option_string() + "-k " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Print out heartbeat version.
# File lib/rha/daemon.rb, line 185 def version tmp = Tempfile.new('tmp') command = option_string() + "-V " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end
Private Instance Methods
# File lib/rha/daemon.rb, line 207 def option_string() unless @path_to_heartbeat ostring = "heartbeat " else ostring = @path_to_heartbeat + " " end if @option ostring += @option + " " end if @debug_level ostring += "-d " + @debug_level end return ostring end