Permalink
Browse files

Option -p / --prefix prepends identifier to worker process names.

  • Loading branch information...
1 parent fc5bdcf commit e4c91daf96a953079def7ae22cb0bd062eea6ef2 @pwnall pwnall committed with gaffneyc Feb 10, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/delayed/command.rb
View
4 lib/delayed/command.rb
@@ -47,6 +47,9 @@ def initialize(args)
opts.on('--sleep-delay N', "Amount of time to sleep when no jobs are found") do |n|
@options[:sleep_delay] = n
end
+ opts.on('-p', '--prefix NAME', "String to be prefixed to worker process names") do |prefix|
+ @options[:prefix] = prefix
+ end
end
@args = opts.parse!(args)
end
@@ -76,6 +79,7 @@ def daemonize
def run_process(process_name, dir)
Daemons.run_proc(process_name, :dir => dir, :dir_mode => :normal, :monitor => @monitor, :ARGV => @args) do |*args|
+ $0 = File.join @options[:prefix], process_name if @options[:prefix]
run process_name
end
end

0 comments on commit e4c91da

Please sign in to comment.