class Daemons::Reporter

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/daemons/reporter.rb, line 5
def initialize(options)
  @options = options

  if !options[:shush]
    $stdout.sync = true
  end
end

Public Instance Methods

backtrace_not_supported() click to toggle source
# File lib/daemons/reporter.rb, line 31
def backtrace_not_supported 
  output_message 'option :backtrace is not supported with :mode => :exec, ignoring'
end
cannot_stop_process(app_name, pid) click to toggle source
# File lib/daemons/reporter.rb, line 43
def cannot_stop_process(app_name, pid)
  output_message "#{app_name}: unable to forcefully kill process with pid #{pid}."
end
changing_process_privilege(user, group = user) click to toggle source
# File lib/daemons/reporter.rb, line 19
def changing_process_privilege(user, group = user)
  output_message "Changing process privilege to #{user}:#{group}"
end
deleted_found_pidfile(pid, f) click to toggle source
# File lib/daemons/reporter.rb, line 23
def deleted_found_pidfile(pid, f)
  output_message "pid-file for killed process #{pid} found (#{f}), deleting."
end
forcefully_stopping_process(app_name, pid) click to toggle source
# File lib/daemons/reporter.rb, line 39
def forcefully_stopping_process(app_name, pid)
  output_message "#{app_name}: process with pid #{pid} won't stop, we forcefully kill it..." 
end
output_message(message) click to toggle source
# File lib/daemons/reporter.rb, line 13
def output_message(message)
  if !options[:shush]
    puts message
  end
end
process_started(app_name, pid) click to toggle source
# File lib/daemons/reporter.rb, line 27
def process_started(app_name, pid)
  output_message  "#{app_name}: process with pid #{pid} started."
end
status(app_name, running, pid_exists, pid) click to toggle source
# File lib/daemons/reporter.rb, line 51
def status(app_name, running, pid_exists, pid)
  output_message "#{app_name}: #{running ? '' : 'not '}running#{(running and pid_exists) ? ' [pid ' + pid.to_s + ']' : ''}#{(pid_exists and not running) ? ' (but pid-file exists: ' + pid.to_s + ')' : ''}"
end
stopped_process(app_name, pid) click to toggle source
# File lib/daemons/reporter.rb, line 47
def stopped_process(app_name, pid)
  output_message "#{app_name}: process with pid #{pid} successfully stopped."
end
stopping_process(app_name, pid) click to toggle source
# File lib/daemons/reporter.rb, line 35
def stopping_process(app_name, pid)
  output_message "#{app_name}: trying to stop process with pid #{pid}..."
end