Class: Daemons::Reporter
- Inherits:
-
Object
- Object
- Daemons::Reporter
- Defined in:
- lib/daemons/reporter.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #backtrace_not_supported ⇒ Object
- #cannot_stop_process(app_name, pid) ⇒ Object
- #changing_process_privilege(user, group = user) ⇒ Object
- #deleted_found_pidfile(pid, f) ⇒ Object
-
#initialize(options) ⇒ Reporter
constructor
A new instance of Reporter.
- #output_message(message) ⇒ Object
- #process_started(app_name, pid) ⇒ Object
- #status(app_name, running, pid_exists, pid) ⇒ Object
- #stopped_process(app_name, pid) ⇒ Object
- #stopping_process(app_name, pid, sig, wait) ⇒ Object
Constructor Details
#initialize(options) ⇒ Reporter
Returns a new instance of Reporter.
5 6 7 8 9 10 11 |
# File 'lib/daemons/reporter.rb', line 5 def initialize() @options = if ![:shush] $stdout.sync = true end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/daemons/reporter.rb', line 3 def @options end |
Instance Method Details
#backtrace_not_supported ⇒ Object
31 32 33 |
# File 'lib/daemons/reporter.rb', line 31 def backtrace_not_supported 'option :backtrace is not supported with :mode => :exec, ignoring' end |
#cannot_stop_process(app_name, pid) ⇒ Object
40 41 42 43 |
# File 'lib/daemons/reporter.rb', line 40 def cannot_stop_process(app_name, pid) "#{app_name}: unable to forcefully kill process with pid #{pid}." $stdout.flush end |
#changing_process_privilege(user, group = user) ⇒ Object
19 20 21 |
# File 'lib/daemons/reporter.rb', line 19 def changing_process_privilege(user, group = user) "Changing process privilege to #{user}:#{group}" end |
#deleted_found_pidfile(pid, f) ⇒ Object
23 24 25 |
# File 'lib/daemons/reporter.rb', line 23 def deleted_found_pidfile(pid, f) "pid-file for killed process #{pid} found (#{f}), deleting." end |
#output_message(message) ⇒ Object
13 14 15 16 17 |
# File 'lib/daemons/reporter.rb', line 13 def () if ![:shush] puts end end |
#process_started(app_name, pid) ⇒ Object
27 28 29 |
# File 'lib/daemons/reporter.rb', line 27 def process_started(app_name, pid) "#{app_name}: process with pid #{pid} started." end |
#status(app_name, running, pid_exists, pid) ⇒ Object
50 51 52 |
# File 'lib/daemons/reporter.rb', line 50 def status(app_name, running, pid_exists, pid) "#{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) ⇒ Object
45 46 47 48 |
# File 'lib/daemons/reporter.rb', line 45 def stopped_process(app_name, pid) "#{app_name}: process with pid #{pid} successfully stopped." $stdout.flush end |
#stopping_process(app_name, pid, sig, wait) ⇒ Object
35 36 37 38 |
# File 'lib/daemons/reporter.rb', line 35 def stopping_process(app_name, pid, sig, wait) "#{app_name}: trying to stop process with pid #{pid}#{' forcefully :(' if sig == 'KILL'} sending #{sig} and waiting #{wait}s ..." $stdout.flush end |