From 8ec8ca414ccf94f662ff32d5ba071f8c3319cc71 Mon Sep 17 00:00:00 2001 From: Denis Ahearn Date: Wed, 7 Apr 2010 20:27:51 +0800 Subject: [PATCH] Fixed Delayed::Command daemonize to create tmp/pids directory (if it doesn't exist) before launching worker processes. --- lib/delayed/command.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/delayed/command.rb b/lib/delayed/command.rb index e0ce9604f..961091b2c 100644 --- a/lib/delayed/command.rb +++ b/lib/delayed/command.rb @@ -42,9 +42,12 @@ def daemonize @files_to_reopen << file unless file.closed? end + dir = "#{RAILS_ROOT}/tmp/pids" + Dir.mkdir(dir) unless File.exists?(dir) + worker_count.times do |worker_index| process_name = worker_count == 1 ? "delayed_job" : "delayed_job.#{worker_index}" - Daemons.run_proc(process_name, :dir => "#{RAILS_ROOT}/tmp/pids", :dir_mode => :normal, :ARGV => @args) do |*args| + Daemons.run_proc(process_name, :dir => dir, :dir_mode => :normal, :ARGV => @args) do |*args| run process_name end end