Wait starting fluentd process in #start

This commit is contained in:
uu59 2014-05-23 13:52:03 +09:00
parent 94a26c98d6
commit 22d65e0f92

View File

@ -14,7 +14,7 @@ class Fluentd
def pid def pid
return unless File.exists?(pid_file) return unless File.exists?(pid_file)
File.read(pid_file) File.read(pid_file).to_i rescue nil
end end
def running? def running?
@ -80,7 +80,13 @@ class Fluentd
def start def start
return if running? return if running?
spawn("bundle exec fluentd #{options_to_argv}") # TODO spawn("bundle exec fluentd #{options_to_argv}")
timeout(5) do # TODO: decide how long wait
loop do
break if pid && Process.kill(0, pid)
sleep 0.01
end
end
end end
def stop def stop