Method: Bluth::WorkerBase#kill

Defined in:
lib/bluth/worker.rb

#kill(force = false) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/bluth/worker.rb', line 55

def kill(force=false)
  if force || host == Bluth.sysinfo.hostname
    Familia.info "Destroying #{self.index} (this machine is: #{Bluth.sysinfo.hostname}; worker is: #{host})"
    Worker.kill self.pid_file if File.exists?(self.pid_file) rescue Errno::ESRCH
    File.delete self.log_file if File.exists?(self.log_file)
    destroy!
  else
    Familia.info "Worker #{self.index} not running on #{Bluth.sysinfo.hostname}"
  end
end