Class: God::Conditions::ProcessExits

Inherits:
EventCondition show all
Defined in:
lib/god/conditions/process_exits.rb

Instance Attribute Summary

Attributes inherited from Behavior

#watch

Instance Method Summary collapse

Methods inherited from God::Condition

generate

Methods inherited from Behavior

#after_restart, #after_start, #after_stop, #before_restart, #before_start, #before_stop, generate, #prepare

Instance Method Details

#deregisterObject



19
20
21
22
# File 'lib/god/conditions/process_exits.rb', line 19

def deregister
  pid = File.read(self.watch.pid_file).strip.to_i
  EventHandler.deregister(pid, :proc_exit)
end

#registerObject



11
12
13
14
15
16
17
# File 'lib/god/conditions/process_exits.rb', line 11

def register
  pid = File.read(self.watch.pid_file).strip.to_i
  
  EventHandler.register(pid, :proc_exit) do
    Hub.trigger(self)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/god/conditions/process_exits.rb', line 5

def valid?
  valid = true
  valid &= complain("You must specify the 'pid_file' attribute on the Watch for :process_exits") if self.watch.pid_file.nil?
  valid
end