Class: Eye::ChildProcess
Constant Summary
Process::Notify::LEVELS
Process::Config::DEFAULTS
Instance Attribute Summary collapse
#current_scheduled_command, #last_scheduled_at, #last_scheduled_command, #last_scheduled_reason
Instance Method Summary
collapse
included, #schedule, #schedule_history, #schedule_in, #scheduled_action, #scheduler_actions_list, #scheduler_clear_pending_list
#notify
#app_name, #debug_data, #group_name, #self_status_data, #sub_object?
#clear_pid_file, #execute, #failsafe_load_pid, #failsafe_save_pid, #load_pid_from_file, #pid_file_ctime, #process_realy_running?, #save_pid_to_file, #send_signal, #set_pid_from_file, #wait_for_condition
#add_watchers, #remove_watchers
#[], #c, #control_pid?, #prepare_config, #update_config
#restart_process, #start_process, #stop_process
Constructor Details
#initialize(pid, config = {}, logger_prefix = nil) ⇒ ChildProcess
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/eye/child_process.rb', line 29
def initialize(pid, config = {}, logger_prefix = nil)
raise 'Empty pid' unless pid
@pid = pid
@config = prepare_config(config)
@name = "child-#{pid}"
@full_name = [logger_prefix, @name] * ':'
@watchers = {}
debug "start monitoring CHILD config: #{@config.inspect}"
start_checkers
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
27
28
29
|
# File 'lib/eye/child_process.rb', line 27
def config
@config
end
|
#full_name ⇒ Object
Returns the value of attribute full_name.
27
28
29
|
# File 'lib/eye/child_process.rb', line 27
def full_name
@full_name
end
|
#name ⇒ Object
Returns the value of attribute name.
27
28
29
|
# File 'lib/eye/child_process.rb', line 27
def name
@name
end
|
#pid ⇒ Object
Returns the value of attribute pid.
27
28
29
|
# File 'lib/eye/child_process.rb', line 27
def pid
@pid
end
|
#watchers ⇒ Object
Returns the value of attribute watchers.
27
28
29
|
# File 'lib/eye/child_process.rb', line 27
def watchers
@watchers
end
|
Instance Method Details
#delete ⇒ Object
81
82
|
# File 'lib/eye/child_process.rb', line 81
def delete
end
|
#destroy ⇒ Object
84
85
86
87
|
# File 'lib/eye/child_process.rb', line 84
def destroy
remove_watchers
terminate
end
|
#logger_tag ⇒ Object
44
45
46
|
# File 'lib/eye/child_process.rb', line 44
def logger_tag
full_name
end
|
#monitor ⇒ Object
75
76
|
# File 'lib/eye/child_process.rb', line 75
def monitor
end
|
#restart ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/eye/child_process.rb', line 67
def restart
if self[:restart_command]
execute_restart_command
else
stop
end
end
|
#send_command(command, *args) ⇒ Object
56
57
58
|
# File 'lib/eye/child_process.rb', line 56
def send_command(command, *args)
schedule command, *args, Eye::Reason::User.new(command)
end
|
#signal(sig) ⇒ Object
89
90
91
|
# File 'lib/eye/child_process.rb', line 89
def signal(sig)
send_signal(sig) if self.pid
end
|
#start ⇒ Object
60
61
|
# File 'lib/eye/child_process.rb', line 60
def start
end
|
#state ⇒ Object
48
49
50
|
# File 'lib/eye/child_process.rb', line 48
def state
:up
end
|
#status_data(debug = false) ⇒ Object
93
94
95
|
# File 'lib/eye/child_process.rb', line 93
def status_data(debug = false)
self_status_data(debug)
end
|
#stop ⇒ Object
63
64
65
|
# File 'lib/eye/child_process.rb', line 63
def stop
kill_process
end
|
#unmonitor ⇒ Object
78
79
|
# File 'lib/eye/child_process.rb', line 78
def unmonitor
end
|
#up? ⇒ Boolean
52
53
54
|
# File 'lib/eye/child_process.rb', line 52
def up?
state == :up
end
|