Module: Eye::Process::Controller
- Included in:
- Eye::Process
- Defined in:
- lib/eye/process/controller.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #freeze ⇒ Object
- #monitor ⇒ Object
- #restart ⇒ Object
- #send_command(command, *args) ⇒ Object
- #signal(sig = 0) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #unmonitor ⇒ Object
- #user_command(name) ⇒ Object
Instance Method Details
#delete ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/eye/process/controller.rb', line 42 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 |
#freeze ⇒ Object
65 66 67 |
# File 'lib/eye/process/controller.rb', line 65 def freeze scheduler_freeze end |
#monitor ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eye/process/controller.rb', line 26 def monitor if self[:auto_start] start else if load_external_pid_file == :ok switch :already_running else schedule :unmonitor, Eye::Reason.new(:'not found') end end end |
#restart ⇒ Object
21 22 23 24 |
# File 'lib/eye/process/controller.rb', line 21 def restart load_external_pid_file unless pid # unmonitored case restart_process end |
#send_command(command, *args) ⇒ Object
3 4 5 |
# File 'lib/eye/process/controller.rb', line 3 def send_command(command, *args) schedule command, *args, Eye::Reason::User.new(command) end |
#signal(sig = 0) ⇒ Object
55 56 57 |
# File 'lib/eye/process/controller.rb', line 55 def signal(sig = 0) send_signal(sig) if self.pid end |
#start ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/eye/process/controller.rb', line 7 def start if load_external_pid_file == :ok switch :already_running :ok else start_process end end |
#stop ⇒ Object
16 17 18 19 |
# File 'lib/eye/process/controller.rb', line 16 def stop stop_process switch :unmonitoring end |
#unmonitor ⇒ Object
38 39 40 |
# File 'lib/eye/process/controller.rb', line 38 def unmonitor switch :unmonitoring end |
#user_command(name) ⇒ Object
59 60 61 62 63 |
# File 'lib/eye/process/controller.rb', line 59 def user_command(name) if self[:user_commands] && c = self[:user_commands][name.to_sym] execute_user_command(name, c) end end |