Skip to content

Commit

Permalink
Specify log dir for daemons process logs
Browse files Browse the repository at this point in the history
  • Loading branch information
back2war committed Oct 12, 2023
1 parent ec463a3 commit 25843d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 25843d4

Please sign in to comment.