module Eye::Process::Controller

Public Instance Methods

delete() click to toggle source
# File lib/eye/process/controller.rb, line 39
def delete
  if self[:stop_on_delete]
    info 'process has stop_on_delete option, so sync-stop it first'
    stop
  end

  remove_watchers
  remove_children
  remove_triggers

  terminate
end
monitor() click to toggle source
# File lib/eye/process/controller.rb, line 25
def monitor
  if self[:auto_start]
    start
  elsif load_external_pid_file == :ok
    switch :already_running
  else
    schedule command: :unmonitor, reason: 'not found'
  end
end
restart() click to toggle source
# File lib/eye/process/controller.rb, line 20
def restart
  load_external_pid_file unless pid # unmonitored case
  restart_process
end
signal(sig = 0) click to toggle source
# File lib/eye/process/controller.rb, line 52
def signal(sig = 0)
  send_signal(sig) if self.pid
end
start() click to toggle source

scheduled actions :update_config, :start, :stop, :restart, :unmonitor, :monitor, :break_chain, :delete, :signal, :user_command

# File lib/eye/process/controller.rb, line 6
def start
  if load_external_pid_file == :ok
    switch :already_running
    :ok
  else
    start_process
  end
end
stop() click to toggle source
# File lib/eye/process/controller.rb, line 15
def stop
  stop_process
  switch :unmonitoring
end
unmonitor() click to toggle source
# File lib/eye/process/controller.rb, line 35
def unmonitor
  switch :unmonitoring
end
user_command(name) click to toggle source
# File lib/eye/process/controller.rb, line 56
def user_command(name)
  if self[:user_commands] && c = self[:user_commands][name.to_sym]
    execute_user_command(name, c)
  end
end