From 25843d4b8a0c72d963385e2e42b58169564dc2aa Mon Sep 17 00:00:00 2001 From: Yulian Tarantiuk Date: Thu, 12 Oct 2023 10:23:15 +0300 Subject: [PATCH] Specify log dir for daemons process logs --- lib/delayed/command.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/delayed/command.rb b/lib/delayed/command.rb index 5ff62dd95..9340be40c 100644 --- a/lib/delayed/command.rb +++ b/lib/delayed/command.rb @@ -19,7 +19,7 @@ def initialize(args) # rubocop:disable MethodLength @options = { :quiet => true, :pid_dir => "#{root}/tmp/pids", - :log_dir => "#{root}/log" + :log_dir => "#{root}/log/dj_process_logs" } @worker_count = 1 @@ -87,6 +87,7 @@ def initialize(args) # rubocop:disable MethodLength def daemonize # rubocop:disable PerceivedComplexity dir = @options[:pid_dir] FileUtils.mkdir_p(dir) unless File.exist?(dir) + FileUtils.mkdir_p(@options[:log_dir]) unless File.exist?(@options[:log_dir]) if worker_pools setup_pools @@ -120,7 +121,7 @@ def setup_pools def run_process(process_name, options = {}) Delayed::Worker.before_fork - Daemons.run_proc(process_name, :log_output => true, :dir => options[:pid_dir], :dir_mode => :normal, :no_wait => true, :monitor => @monitor, :ARGV => @args) do |*_args| + Daemons.run_proc(process_name, :log_output => true, :dir => options[:pid_dir], :log_dir => options[:log_dir], :dir_mode => :normal, :no_wait => true, :monitor => @monitor, :ARGV => @args) do |*_args| $0 = File.join(options[:prefix], process_name) if @options[:prefix] run process_name, options end