From ecbff236982f0ac94555171f86cee217929a978a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 23 Feb 2009 16:10:02 -0800 Subject: Allow overriding :directory or via -C/--directory This allows Unicorn to be constantly started in symlink paths such as the ones Capistrano creates (e.g. "/u/apps/$app/current") --- bin/unicorn | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/unicorn b/bin/unicorn index f682311..dd4cc64 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -78,6 +78,10 @@ opts = OptionParser.new("", 24, ' ') do |opts| listeners << address end + opts.on("-C", "--directory PATH", "run in this directory") do |d| + options[:directory] = d + end + opts.on("-c", "--config-file FILE", "Unicorn-specific config file") do |f| options[:config_file] = File.expand_path(f) end @@ -159,11 +163,11 @@ if daemonize exit if fork end - Dir.chdir("/") + Dir.chdir("/") # setting options[:directory] will override this later on File.umask(0000) STDIN.reopen("/dev/null") - # we can redirect these again in the Unicorn after_fork hook + # we can redirect these again in the Unicorn {before,after}_fork hooks STDOUT.reopen("/dev/null", "a") STDERR.reopen("/dev/null", "a") end -- cgit v1.2.3-24-ge0c7