diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-12-04 03:50:57 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-12-04 03:50:57 +0000 |
commit | 56267474dac278898bf2f53b9a43fb68bd83f43d (patch) | |
tree | beafc3f8d10dc3e6f70ab269e5add330f1331b64 /railties/lib/commands/process | |
parent | 2794f4164fcdba2cfc704851918c6c869215c045 (diff) | |
download | rails-56267474dac278898bf2f53b9a43fb68bd83f43d.tar.gz rails-56267474dac278898bf2f53b9a43fb68bd83f43d.tar.bz2 rails-56267474dac278898bf2f53b9a43fb68bd83f43d.zip |
Fixed script/process/spawner to work properly with Mongrel including in -r (daemonize mode) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5672 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/commands/process')
-rw-r--r-- | railties/lib/commands/process/spawner.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb index 43d652b4e5..c8ca1d04a2 100644 --- a/railties/lib/commands/process/spawner.rb +++ b/railties/lib/commands/process/spawner.rb @@ -56,11 +56,18 @@ end class MongrelSpawner < Spawner def self.spawn(port) - cmd = "mongrel_rails start -d -p #{port} -P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid -e #{OPTIONS[:environment]}" - cmd << "-a #{OPTIONS[:address]}" if can_bind_to_custom_address? + cmd = + "mongrel_rails start -d " + + "-a #{OPTIONS[:address]} " + + "-p #{port} " + + "-P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid " + + "-e #{OPTIONS[:environment]} " + + "-c #{OPTIONS[:rails_root]} " + + "-l #{OPTIONS[:rails_root]}/log/mongrel.log" + system(cmd) end - + def self.can_bind_to_custom_address? true end @@ -109,6 +116,7 @@ OPTIONS = { :spawner => '/usr/bin/env spawn-fcgi', :dispatcher => File.expand_path(RAILS_ROOT + '/public/dispatch.fcgi'), :pids => File.expand_path(RAILS_ROOT + "/tmp/pids"), + :rails_root => File.expand_path(RAILS_ROOT), :process => "dispatch", :port => 8000, :address => '0.0.0.0', @@ -165,9 +173,11 @@ ARGV.options do |opts| opts.on(" Options:") opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| } + if spawner_class.can_bind_to_custom_address? opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |OPTIONS[:address]| } end + opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v } opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v } opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v } @@ -196,4 +206,4 @@ if OPTIONS[:repeat] end else spawner_class.spawn_all -end +end
\ No newline at end of file |