about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-02-10 02:38:18 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-02-10 02:38:18 +0000
commitbce8665853fd1ef66771e462247c9712cf18f0b1 (patch)
tree566ebed98b6c8c94292894771c21fb799013481f /bin
parent3c343cca6b736e43c6145ebdf60aed2cd61b912c (diff)
downloadunicorn-bce8665853fd1ef66771e462247c9712cf18f0b1.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@24 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails21
1 files changed, 11 insertions, 10 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index 3f7b124..0392949 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -1,4 +1,4 @@
-require 'config/environment'
+require 'rubygems'
 require 'mongrel'
 require 'cgi'
 begin
@@ -78,12 +78,13 @@ end
 
 cwd = Dir.pwd
 
-#Daemonize.daemonize(log_file=File.join(cwd,"log","mongrel.log"))
-#Dir.chdir(cwd)
-
-open(File.join(cwd,"log/mongrel-#{ARGV[1]}.pid"),"w") {|f| f.write(Process.pid) }
-h = Mongrel::HttpServer.new(ARGV[0], ARGV[1])
-h.register("/", RailsHandler.new(File.join(cwd,"public")))
-h.run
-
-h.acceptor.join
+Daemonize.daemonize(log_file=File.join(cwd,"log","mongrel.log"))
+Dir.chdir(cwd) do
+  require 'config/environment'
+  open(File.join(cwd,"log/mongrel-#{ARGV[1]}.pid"),"w") {|f| f.write(Process.pid) }
+  h = Mongrel::HttpServer.new(ARGV[0], ARGV[1])
+  h.register("/", RailsHandler.new(File.join(cwd,"public")))
+  h.run
+  
+  h.acceptor.join
+end