class Eye::ChildProcess

Attributes

config[R]
full_name[R]
name[R]
pid[R]
watchers[R]

Public Class Methods

new(pid, config = {}, logger_prefix = nil, parent_pid = nil) click to toggle source
# File lib/eye/child_process.rb, line 29
def initialize(pid, config = {}, logger_prefix = nil, parent_pid = nil)
  raise 'Empty pid' unless pid

  @pid = pid
  @parent_pid = parent_pid
  @config = prepare_config(config)
  @name = "child-#{pid}"
  @full_name = [logger_prefix, @name] * ':'

  @watchers = {}

  debug "start monitoring CHILD config: #{@config.inspect}"

  start_checkers
end

Public Instance Methods

delete() click to toggle source
# File lib/eye/child_process.rb, line 82
def delete
end
destroy() click to toggle source
# File lib/eye/child_process.rb, line 85
def destroy
  remove_watchers
  terminate
end
logger_tag() click to toggle source
# File lib/eye/child_process.rb, line 45
def logger_tag
  full_name
end
monitor() click to toggle source
# File lib/eye/child_process.rb, line 76
def monitor
end
prepare_command(command) click to toggle source
Calls superclass method Eye::Process::Commands#prepare_command
# File lib/eye/child_process.rb, line 98
def prepare_command(command) # override
  super.gsub('{PARENT_PID}', @parent_pid.to_s)
end
restart() click to toggle source
# File lib/eye/child_process.rb, line 68
def restart
  if self[:restart_command]
    execute_restart_command
  else
    stop
  end
end
send_command(command, *args) click to toggle source
# File lib/eye/child_process.rb, line 57
def send_command(command, *args)
  schedule command, *args, Eye::Reason::User.new(command)
end
signal(sig) click to toggle source
# File lib/eye/child_process.rb, line 90
def signal(sig)
  send_signal(sig) if self.pid
end
start() click to toggle source
# File lib/eye/child_process.rb, line 61
def start
end
state() click to toggle source
# File lib/eye/child_process.rb, line 49
def state
  :up
end
status_data(debug = false) click to toggle source
# File lib/eye/child_process.rb, line 94
def status_data(debug = false)
  self_status_data(debug)
end
stop() click to toggle source
# File lib/eye/child_process.rb, line 64
def stop
  kill_process
end
unmonitor() click to toggle source
# File lib/eye/child_process.rb, line 79
def unmonitor
end
up?() click to toggle source
# File lib/eye/child_process.rb, line 53
def up?
  state == :up
end