From 264e71107dc27b46059ebbeff7d66c8469111ce6 Mon Sep 17 00:00:00 2001 From: uu59 Date: Tue, 27 May 2014 10:56:41 +0900 Subject: [PATCH] Fix error if pidfile exists and process not exists --- app/models/fluentd/agent/common.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/fluentd/agent/common.rb b/app/models/fluentd/agent/common.rb index 59796ba..84d609f 100644 --- a/app/models/fluentd/agent/common.rb +++ b/app/models/fluentd/agent/common.rb @@ -33,7 +33,12 @@ class Fluentd end def running? - pid && Process.kill(0, pid) + begin + pid && Process.kill(0, pid) + rescue Errno::ESRCH + File.unlink(pid_file) # no needed any more + false + end end def log