eye 0.7 → 0.8.celluloid15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +141 -0
  3. data/.travis.yml +5 -3
  4. data/CHANGES.md +9 -1
  5. data/README.md +5 -2
  6. data/Rakefile +6 -6
  7. data/bin/leye +9 -4
  8. data/bin/loader_eye +14 -15
  9. data/examples/custom_check.eye +24 -0
  10. data/examples/custom_trigger.eye +30 -0
  11. data/examples/delayed_job.eye +3 -3
  12. data/examples/dependency.eye +10 -11
  13. data/examples/leye_example/Eyefile +10 -0
  14. data/examples/notify.eye +3 -4
  15. data/examples/plugin/main.eye +5 -5
  16. data/examples/plugin/plugin.rb +10 -2
  17. data/examples/process_thin.rb +8 -8
  18. data/examples/processes/em.rb +18 -12
  19. data/examples/processes/forking.rb +5 -5
  20. data/examples/processes/sample.rb +46 -44
  21. data/examples/puma.eye +9 -8
  22. data/examples/rbenv.eye +5 -5
  23. data/examples/sidekiq.eye +3 -3
  24. data/examples/stress_test.eye +4 -4
  25. data/examples/syslog.eye +1 -1
  26. data/examples/test.eye +1 -2
  27. data/examples/thin-farm.eye +7 -8
  28. data/examples/triggers.eye +13 -15
  29. data/examples/unicorn.eye +12 -13
  30. data/eye.gemspec +16 -14
  31. data/lib/eye.rb +2 -3
  32. data/lib/eye/application.rb +5 -6
  33. data/lib/eye/checker.rb +44 -25
  34. data/lib/eye/checker/children_count.rb +1 -1
  35. data/lib/eye/checker/file_ctime.rb +1 -1
  36. data/lib/eye/checker/http.rb +13 -15
  37. data/lib/eye/checker/nop.rb +1 -0
  38. data/lib/eye/checker/socket.rb +60 -63
  39. data/lib/eye/checker/ssl_socket.rb +5 -5
  40. data/lib/eye/child_process.rb +6 -4
  41. data/lib/eye/cli.rb +74 -46
  42. data/lib/eye/cli/commands.rb +4 -5
  43. data/lib/eye/cli/render.rb +61 -41
  44. data/lib/eye/cli/server.rb +19 -16
  45. data/lib/eye/client.rb +1 -0
  46. data/lib/eye/config.rb +36 -33
  47. data/lib/eye/controller.rb +2 -3
  48. data/lib/eye/controller/commands.rb +1 -1
  49. data/lib/eye/controller/helpers.rb +2 -2
  50. data/lib/eye/controller/load.rb +19 -17
  51. data/lib/eye/controller/options.rb +1 -5
  52. data/lib/eye/controller/send_command.rb +21 -23
  53. data/lib/eye/controller/status.rb +17 -14
  54. data/lib/eye/dsl.rb +6 -1
  55. data/lib/eye/dsl/application_opts.rb +4 -3
  56. data/lib/eye/dsl/chain.rb +2 -2
  57. data/lib/eye/dsl/child_process_opts.rb +3 -3
  58. data/lib/eye/dsl/config_opts.rb +7 -7
  59. data/lib/eye/dsl/group_opts.rb +3 -3
  60. data/lib/eye/dsl/helpers.rb +1 -1
  61. data/lib/eye/dsl/main.rb +4 -3
  62. data/lib/eye/dsl/opts.rb +31 -28
  63. data/lib/eye/dsl/process_opts.rb +13 -7
  64. data/lib/eye/dsl/pure_opts.rb +13 -9
  65. data/lib/eye/dsl/validation.rb +48 -35
  66. data/lib/eye/group.rb +23 -8
  67. data/lib/eye/group/chain.rb +6 -6
  68. data/lib/eye/loader.rb +3 -3
  69. data/lib/eye/local.rb +9 -4
  70. data/lib/eye/logger.rb +11 -4
  71. data/lib/eye/notify.rb +10 -6
  72. data/lib/eye/notify/jabber.rb +1 -1
  73. data/lib/eye/notify/mail.rb +2 -2
  74. data/lib/eye/notify/slack.rb +4 -3
  75. data/lib/eye/process.rb +2 -0
  76. data/lib/eye/process/children.rb +4 -4
  77. data/lib/eye/process/commands.rb +38 -39
  78. data/lib/eye/process/config.rb +22 -16
  79. data/lib/eye/process/controller.rb +5 -19
  80. data/lib/eye/process/data.rb +11 -9
  81. data/lib/eye/process/monitor.rb +86 -76
  82. data/lib/eye/process/notify.rb +10 -10
  83. data/lib/eye/process/scheduler.rb +36 -31
  84. data/lib/eye/process/states.rb +7 -5
  85. data/lib/eye/process/states_history.rb +9 -3
  86. data/lib/eye/process/system.rb +35 -20
  87. data/lib/eye/process/trigger.rb +1 -5
  88. data/lib/eye/process/watchers.rb +12 -9
  89. data/lib/eye/reason.rb +4 -1
  90. data/lib/eye/server.rb +3 -2
  91. data/lib/eye/system.rb +22 -15
  92. data/lib/eye/system_resources.rb +17 -8
  93. data/lib/eye/trigger.rb +18 -16
  94. data/lib/eye/trigger/check_dependency.rb +7 -4
  95. data/lib/eye/trigger/flapping.rb +24 -7
  96. data/lib/eye/trigger/starting_guard.rb +7 -6
  97. data/lib/eye/trigger/stop_children.rb +2 -2
  98. data/lib/eye/trigger/transition.rb +1 -1
  99. data/lib/eye/trigger/wait_dependency.rb +3 -2
  100. data/lib/eye/utils.rb +4 -3
  101. data/lib/eye/utils/alive_array.rb +9 -4
  102. data/lib/eye/utils/celluloid_chain.rb +12 -10
  103. data/lib/eye/utils/mini_active_support.rb +16 -16
  104. data/lib/eye/utils/pmap.rb +2 -0
  105. data/lib/eye/utils/tail.rb +2 -2
  106. metadata +39 -8
  107. data/lib/eye/utils/leak_19.rb +0 -10
@@ -1,6 +1,7 @@
1
1
  require 'celluloid'
2
2
 
3
3
  class Eye::Notify
4
+
4
5
  include Celluloid
5
6
  include Eye::Dsl::Validation
6
7
 
@@ -8,7 +9,7 @@ class Eye::Notify
8
9
  autoload :Jabber, 'eye/notify/jabber'
9
10
  autoload :Slack, 'eye/notify/slack'
10
11
 
11
- TYPES = {:mail => 'Mail', :jabber => 'Jabber', :slack => 'Slack'}
12
+ TYPES = { mail: 'Mail', jabber: 'Jabber', slack: 'Slack' }
12
13
 
13
14
  def self.get_class(type)
14
15
  klass = eval("Eye::Notify::#{TYPES[type]}") rescue nil
@@ -35,19 +36,19 @@ class Eye::Notify
35
36
 
36
37
  create_proc = lambda do |nh|
37
38
  type = nh[:type]
38
- config = (settings[type] || {}).merge(nh[:opts] || {}).merge(:contact => nh[:contact])
39
+ config = (settings[type] || {}).merge(nh[:opts] || {}).merge(contact: nh[:contact])
39
40
  klass = get_class(type)
40
41
  notify = klass.new(config, message_h)
41
42
  notify.async_notify if notify
42
43
  end
43
44
 
44
45
  if needed_hash.is_a?(Array)
45
- needed_hash.each{|nh| create_proc[nh] }
46
+ needed_hash.each { |nh| create_proc[nh] }
46
47
  else
47
48
  create_proc[needed_hash]
48
49
  end
49
50
 
50
- rescue Exception, Timeout::Error => ex
51
+ rescue Object => ex
51
52
  log_ex(ex)
52
53
  end
53
54
 
@@ -66,7 +67,7 @@ class Eye::Notify
66
67
 
67
68
  def async_notify
68
69
  async.notify
69
- after(TIMEOUT){ terminate }
70
+ after(TIMEOUT) { terminate }
70
71
  end
71
72
 
72
73
  def notify
@@ -102,15 +103,18 @@ class Eye::Notify
102
103
  end
103
104
 
104
105
  class Custom < Eye::Notify
106
+
105
107
  def self.inherited(base)
106
108
  super
107
109
  register(base)
108
110
  end
111
+
109
112
  end
110
113
 
111
- %w{at host message name full_name pid level}.each do |name|
114
+ %w[at host message name full_name pid level].each do |name|
112
115
  define_method("msg_#{name}") do
113
116
  @message_h[name.to_sym]
114
117
  end
115
118
  end
119
+
116
120
  end
@@ -27,4 +27,4 @@ class Eye::Notify::Jabber < Eye::Notify
27
27
  client.close
28
28
  end
29
29
 
30
- end
30
+ end
@@ -41,8 +41,8 @@ class Eye::Notify::Mail < Eye::Notify
41
41
  h << "To: <#{contact}>"
42
42
  h << "Subject: #{message_subject}"
43
43
  h << "Date: #{msg_at.httpdate}"
44
- h << "Message-Id: <#{rand(1000000000).to_s(36)}.#{$$}.#{contact}>"
44
+ h << "Message-Id: <#{rand(1_000_000_000).to_s(36)}.#{$$}.#{contact}>"
45
45
  "#{h * "\n"}\n#{message_body}"
46
46
  end
47
47
 
48
- end
48
+ end
@@ -8,8 +8,8 @@ class Eye::Notify::Slack < Eye::Notify
8
8
  # end
9
9
 
10
10
  param :webhook_url, String, true
11
- param :channel, String, nil, "#default"
12
- param :username, String, nil, "eye"
11
+ param :channel, String, nil, '#default'
12
+ param :username, String, nil, 'eye'
13
13
 
14
14
  param :icon, String
15
15
 
@@ -35,4 +35,5 @@ class Eye::Notify::Slack < Eye::Notify
35
35
  payload << "> #{msg_message}"
36
36
  payload
37
37
  end
38
- end
38
+
39
+ end
@@ -1,6 +1,7 @@
1
1
  require 'celluloid'
2
2
 
3
3
  class Eye::Process
4
+
4
5
  include Celluloid
5
6
 
6
7
  autoload :Config, 'eye/process/config'
@@ -77,6 +78,7 @@ class Eye::Process
77
78
 
78
79
  # validate
79
80
  extend Eye::Process::Validate
81
+
80
82
  end
81
83
 
82
84
  # include state_machine states
@@ -31,17 +31,17 @@ module Eye::Process::Children
31
31
 
32
32
  if new_children.present?
33
33
  new_children.each do |child_pid|
34
- cfg = self[:monitor_children].try :update, :notify => self[:notify]
34
+ cfg = self[:monitor_children].try :update, notify: self[:notify]
35
35
  self.children[child_pid] = Eye::ChildProcess.new(child_pid, cfg, logger.prefix, current_actor)
36
36
  end
37
37
  end
38
38
 
39
39
  if removed_children.present?
40
- removed_children.each{|child_pid| remove_child(child_pid) }
40
+ removed_children.each { |child_pid| remove_child(child_pid) }
41
41
  end
42
42
 
43
- h = {:new => new_children.size, :removed => removed_children.size, :exists => exist_children.size }
44
- debug { "children info: #{ h.inspect }" }
43
+ h = { new: new_children.size, removed: removed_children.size, exists: exist_children.size }
44
+ debug { "children info: #{h.inspect}" }
45
45
 
46
46
  @updating_children = false
47
47
  h
@@ -25,7 +25,6 @@ module Eye::Process::Commands
25
25
  sleep 0.2 # little grace
26
26
  end
27
27
 
28
- self.pid = nil
29
28
  switch :crashed
30
29
  end
31
30
 
@@ -42,6 +41,8 @@ module Eye::Process::Commands
42
41
 
43
42
  switch :stopping
44
43
 
44
+ return unless check_identity
45
+
45
46
  kill_process
46
47
 
47
48
  if process_really_running?
@@ -69,9 +70,11 @@ module Eye::Process::Commands
69
70
  switch :restarting
70
71
 
71
72
  if self[:restart_command]
72
- execute_restart_command
73
- sleep_grace(:restart_grace)
74
- result = check_alive_with_refresh_pid_if_needed
73
+ return unless check_identity
74
+ if execute_restart_command
75
+ sleep_grace(:restart_grace)
76
+ end
77
+ result = process_really_running? || (load_external_pid_file == :ok)
75
78
  switch(result ? :restarted : :crashed)
76
79
  else
77
80
  stop_process
@@ -96,10 +99,9 @@ private
96
99
  if self[:stop_command]
97
100
  cmd = prepare_command(self[:stop_command])
98
101
  info "executing: `#{cmd}` with stop_timeout: #{self[:stop_timeout].to_f}s and stop_grace: #{self[:stop_grace].to_f}s"
99
- res = execute(cmd, config.merge(:timeout => self[:stop_timeout]))
102
+ res = execute(cmd, config.merge(timeout: self[:stop_timeout]))
100
103
 
101
104
  if res[:error]
102
-
103
105
  if res[:error].class == Timeout::Error
104
106
  error "stop_command failed with #{res[:error].inspect}; try tuning the stop_timeout value"
105
107
  else
@@ -112,7 +114,6 @@ private
112
114
  elsif self[:stop_signals]
113
115
  info "executing stop_signals #{self[:stop_signals].inspect}"
114
116
  stop_signals = self[:stop_signals].clone
115
-
116
117
  signal = stop_signals.shift
117
118
  send_signal(signal)
118
119
 
@@ -120,7 +121,7 @@ private
120
121
  delay = stop_signals.shift
121
122
  signal = stop_signals.shift
122
123
 
123
- if wait_for_condition(delay.to_f, 0.3){ !process_really_running? }
124
+ if wait_for_condition(delay.to_f, 0.3) { !process_really_running? }
124
125
  info 'has terminated'
125
126
  break
126
127
  end
@@ -133,7 +134,6 @@ private
133
134
  else # default command
134
135
  debug { "executing: `kill -TERM #{self.pid}` with stop_grace: #{self[:stop_grace].to_f}s" }
135
136
  send_signal(:TERM)
136
-
137
137
  sleep_grace(:stop_grace)
138
138
 
139
139
  # if process not die here, by default we force kill it
@@ -154,7 +154,7 @@ private
154
154
  cmd = prepare_command(self[:restart_command])
155
155
  info "executing: `#{cmd}` with restart_timeout: #{self[:restart_timeout].to_f}s and restart_grace: #{self[:restart_grace].to_f}s"
156
156
 
157
- res = execute(cmd, config.merge(:timeout => self[:restart_timeout]))
157
+ res = execute(cmd, config.merge(timeout: self[:restart_timeout]))
158
158
 
159
159
  if res[:error]
160
160
 
@@ -169,11 +169,9 @@ private
169
169
  end
170
170
 
171
171
  def daemonize_process
172
- time_before = Time.now
173
172
  res = daemonize(self[:start_command], config)
174
- start_time = Time.now - time_before
175
-
176
- info "daemonizing: `#{self[:start_command]}` with start_grace: #{self[:start_grace].to_f}s, env: '#{environment_string}', <#{res[:pid]}> (in #{self[:working_dir]})"
173
+ info "daemonizing: `#{self[:start_command]}` with start_grace: #{self[:start_grace].to_f}s, env: '#{environment_string}'}" \
174
+ ", <#{res[:pid]}> (in #{self[:working_dir]})"
177
175
 
178
176
  if res[:error]
179
177
 
@@ -183,21 +181,21 @@ private
183
181
  error "daemonize failed with #{res[:error].inspect}"
184
182
  end
185
183
 
186
- return {:error => res[:error].inspect}
184
+ return { error: res[:error].inspect }
187
185
  end
188
186
 
189
187
  self.pid = res[:pid]
190
188
 
191
189
  unless self.pid
192
190
  error 'no pid was returned'
193
- return {:error => :empty_pid}
191
+ return { error: :empty_pid }
194
192
  end
195
193
 
196
194
  sleep_grace(:start_grace)
197
195
 
198
196
  unless process_really_running?
199
197
  error "process <#{self.pid}> not found, it may have crashed (#{check_logs_str})"
200
- return {:error => :not_really_running}
198
+ return { error: :not_really_running }
201
199
  end
202
200
 
203
201
  # if we using leaf child stratedy, pid should be used as last child process
@@ -212,47 +210,46 @@ private
212
210
  end
213
211
 
214
212
  if control_pid? && !failsafe_save_pid
215
- return {:error => :cant_write_pid}
213
+ return { error: :cant_write_pid }
216
214
  end
217
215
 
218
216
  res
219
217
  end
220
218
 
221
219
  def execute_process
222
- info "executing: `#{self[:start_command]}` with start_timeout: #{config[:start_timeout].to_f}s, start_grace: #{self[:start_grace].to_f}s, env: '#{environment_string}' (in #{self[:working_dir]})"
223
- time_before = Time.now
224
-
225
- res = execute(self[:start_command], config.merge(:timeout => config[:start_timeout]))
226
- start_time = Time.now - time_before
220
+ info "executing: `#{self[:start_command]}` with start_timeout: #{config[:start_timeout].to_f}s" \
221
+ ", start_grace: #{self[:start_grace].to_f}s, env: '#{environment_string}' (in #{self[:working_dir]})"
222
+ res = execute(self[:start_command], config.merge(timeout: config[:start_timeout]))
227
223
 
228
224
  if res[:error]
229
225
 
230
226
  if res[:error].message == 'Permission denied - open'
231
227
  error "execution failed with #{res[:error].inspect}; ensure that #{[self[:stdout], self[:stderr]]} are writable"
232
228
  elsif res[:error].class == Timeout::Error
233
- error "execution failed with #{res[:error].inspect}; try increasing the start_timeout value (the current value of #{self[:start_timeout]}s seems too short)"
229
+ error "execution failed with #{res[:error].inspect}; try increasing the start_timeout value" \
230
+ "(the current value of #{self[:start_timeout]}s seems too short)"
234
231
  else
235
232
  error "execution failed with #{res[:error].inspect}"
236
233
  end
237
234
 
238
- return {:error => res[:error].inspect}
235
+ return { error: res[:error].inspect }
239
236
  end
240
237
 
241
238
  sleep_grace(:start_grace)
242
239
 
243
- unless set_pid_from_file
244
- error "exit status #{res[:exitstatus]}, pid_file (#{self[:pid_file_ex]}) did not appear within the start_grace period (#{self[:start_grace].to_f}s); check your start_command, or tune the start_grace value (eye expect process to create pid_file in self-daemonization mode)"
245
- return {:error => :pid_not_found}
240
+ case load_external_pid_file
241
+ when :ok
242
+ res.merge(pid: self.pid)
243
+ when :no_pid_file
244
+ error "exit status #{res[:exitstatus]}, pid_file (#{self[:pid_file_ex]}) did not appear within the " \
245
+ "start_grace period (#{self[:start_grace].to_f}s); check your start_command, or tune the start_grace " \
246
+ 'value (eye expect process to create pid_file in self-daemonization mode)'
247
+ { error: :pid_not_found }
248
+ when :not_running
249
+ error "exit status #{res[:exitstatus]}, process <#{@last_loaded_pid}> (from #{self[:pid_file_ex]}) was not found; " \
250
+ "ensure that the pid_file is being updated correctly (#{check_logs_str})"
251
+ { error: :not_really_running }
246
252
  end
247
-
248
- unless process_really_running?
249
- error "exit status #{res[:exitstatus]}, process <#{self.pid}> (from #{self[:pid_file_ex]}) was not found; ensure that the pid_file is being updated correctly (#{check_logs_str})"
250
- return {:error => :not_really_running}
251
- end
252
-
253
- res[:pid] = self.pid
254
- info "exit status #{res[:exitstatus]}, process <#{res[:pid]}> (from #{self[:pid_file_ex]}) was found"
255
- res
256
253
  end
257
254
 
258
255
  def check_logs_str
@@ -278,12 +275,14 @@ private
278
275
  end
279
276
 
280
277
  def execute_user_command(name, cmd)
278
+ return unless check_identity
279
+
281
280
  info "executing user command #{name} #{cmd.inspect}"
282
281
 
283
282
  # cmd is string, or array of signals
284
283
  if cmd.is_a?(String)
285
284
  cmd = prepare_command(cmd)
286
- res = execute(cmd, config.merge(:timeout => 120))
285
+ res = execute(cmd, config.merge(timeout: 120))
287
286
  error "cmd #{cmd} error #{res.inspect}" if res[:error]
288
287
  elsif cmd.is_a?(Array)
289
288
  signals = cmd.clone
@@ -293,7 +292,7 @@ private
293
292
  while signals.present?
294
293
  delay = signals.shift
295
294
  signal = signals.shift
296
- if wait_for_condition(delay.to_f, 0.3){ !process_really_running? }
295
+ if wait_for_condition(delay.to_f, 0.3) { !process_really_running? }
297
296
  info 'has terminated'
298
297
  break
299
298
  end
@@ -1,25 +1,29 @@
1
1
  module Eye::Process::Config
2
2
 
3
3
  DEFAULTS = {
4
- :keep_alive => true, # restart when crashed
5
- :check_alive_period => 5.seconds,
4
+ keep_alive: true, # restart when crashed
5
+ check_alive_period: 5.seconds,
6
6
 
7
- :start_timeout => 15.seconds,
8
- :stop_timeout => 10.seconds,
9
- :restart_timeout => 10.seconds,
7
+ check_identity: true,
8
+ check_identity_period: 60.seconds,
9
+ check_identity_grace: 60.seconds,
10
10
 
11
- :start_grace => 2.5.seconds,
12
- :stop_grace => 0.5.seconds,
13
- :restart_grace => 1.second,
11
+ start_timeout: 15.seconds,
12
+ stop_timeout: 10.seconds,
13
+ restart_timeout: 10.seconds,
14
14
 
15
- :daemonize => false,
16
- :auto_start => true, # auto start on monitor action
15
+ start_grace: 2.5.seconds,
16
+ stop_grace: 0.5.seconds,
17
+ restart_grace: 1.second,
17
18
 
18
- :children_update_period => 30.seconds,
19
- :clear_pid => true, # by default clear pid on stop
19
+ daemonize: false,
20
+ auto_start: true, # auto start on monitor action
20
21
 
21
- :auto_update_pidfile_grace => 30.seconds,
22
- :revert_fuckup_pidfile_grace => 120.seconds,
22
+ children_update_period: 30.seconds,
23
+ clear_pid: true, # by default clear pid on stop
24
+
25
+ auto_update_pidfile_grace: 30.seconds,
26
+ revert_fuckup_pidfile_grace: 120.seconds
23
27
  }
24
28
 
25
29
  def prepare_config(new_config)
@@ -27,12 +31,14 @@ module Eye::Process::Config
27
31
  h[:pid_file_ex] = Eye::System.normalized_file(h[:pid_file], h[:working_dir]) if h[:pid_file]
28
32
  h[:checks] = {} if h[:checks].blank?
29
33
  h[:triggers] = {} if h[:triggers].blank?
30
- h[:children_update_period] = h[:monitor_children][:children_update_period] if h[:monitor_children] && h[:monitor_children][:children_update_period]
34
+ if upd = h.try(:[], :monitor_children).try(:[], :children_update_period)
35
+ h[:children_update_period] = upd
36
+ end
31
37
 
32
38
  # check speedy flapping by default
33
39
  if h[:triggers].blank? || !h[:triggers][:flapping]
34
40
  h[:triggers] ||= {}
35
- h[:triggers][:flapping] = {:type => :flapping, :times => 10, :within => 10.seconds}
41
+ h[:triggers][:flapping] = { type: :flapping, times: 10, within: 10.seconds }
36
42
  end
37
43
 
38
44
  h[:stdout] = Eye::System.normalized_file(h[:stdout], h[:working_dir]) if h[:stdout]
@@ -5,21 +5,12 @@ module Eye::Process::Controller
5
5
  end
6
6
 
7
7
  def start
8
- res = if set_pid_from_file
9
- if process_really_running?
10
- info "process <#{self.pid}> from pid_file is already running"
11
- switch :already_running
12
- :ok
13
- else
14
- info "pid_file found, but process <#{self.pid}> is down, starting..."
15
- start_process
16
- end
8
+ if load_external_pid_file == :ok
9
+ switch :already_running
10
+ :ok
17
11
  else
18
- info 'pid_file not found, starting...'
19
12
  start_process
20
13
  end
21
-
22
- res
23
14
  end
24
15
 
25
16
  def stop
@@ -28,10 +19,7 @@ module Eye::Process::Controller
28
19
  end
29
20
 
30
21
  def restart
31
- unless pid # unmonitored case
32
- try_update_pid_from_file
33
- end
34
-
22
+ load_external_pid_file unless pid # unmonitored case
35
23
  restart_process
36
24
  end
37
25
 
@@ -39,11 +27,9 @@ module Eye::Process::Controller
39
27
  if self[:auto_start]
40
28
  start
41
29
  else
42
- if try_update_pid_from_file
43
- info "process <#{self.pid}> from pid_file is already running"
30
+ if load_external_pid_file == :ok
44
31
  switch :already_running
45
32
  else
46
- warn 'process not found, unmonitoring'
47
33
  schedule :unmonitor, Eye::Reason.new(:'not found')
48
34
  end
49
35
  end