Class: God::Behaviors::CleanPidFile

Inherits:
God::Behavior show all
Defined in:
lib/god/behaviors/clean_pid_file.rb

Instance Attribute Summary

Attributes inherited from God::Behavior

#watch

Instance Method Summary collapse

Methods inherited from God::Behavior

#after_restart, #after_start, #after_stop, #before_restart, #before_stop, #friendly_name, generate

Methods included from Configurable

#base_name, complain, #complain, #friendly_name, #prepare, #reset

Instance Method Details

#before_startObject


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

def before_start
  File.delete(self.watch.pid_file)

  "deleted pid file"
rescue
  "no pid file to delete"
end

#valid?Boolean


5
6
7
8
9
# File 'lib/god/behaviors/clean_pid_file.rb', line 5

def valid?
  valid = true
  valid &= complain("Attribute 'pid_file' must be specified", self) if self.watch.pid_file.nil?
  valid
end