# File lib/daemons/monitor.rb, line 107 def start(applications) return if applications.empty? if @pid.kind_of?(PidFile) start_with_pidfile(applications) else start_without_pidfile(applications) end end
# File lib/daemons/monitor.rb, line 118 def stop begin pid = @pid.pid Process.kill(Application::SIGNAL, pid) Timeout::timeout(5) { while Pid.running?(pid) sleep(0.1) end } rescue ::Exception => e puts "#{e} #{pid}" puts "deleting pid-file." end # We try to remove the pid-files by ourselves, in case the application # didn't clean it up. begin; @pid.cleanup; rescue ::Exception; end end
# File lib/daemons/monitor.rb, line 8 def self.find(dir, app_name) pid = PidFile.find_files(dir, app_name, false)[0] if pid pid = PidFile.existing(pid) unless PidFile.running?(pid.pid) begin; pid.cleanup; rescue ::Exception; end return end monitor = self.allocate monitor.instance_variable_set(:@pid, pid) return monitor end return nil end
Generated with the Darkfish Rdoc Generator 2.