about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-12-16 05:54:59 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-12-16 05:54:59 +0000
commit363c3ba2a158d7a41a67a90d690a0accf638f92b (patch)
treeccf03dd1a0a15d7418ef08c8231d5fbb5df35c1e /bin
parent198a592fcad66ccd264203d7a83ccf299345a430 (diff)
downloadunicorn-363c3ba2a158d7a41a67a90d690a0accf638f92b.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@472 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index 05205cb..506c8cf 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -174,7 +174,8 @@ module Mongrel
     def configure
       options [
         ['-c', '--chdir PATH', "Change to dir before starting (will be expanded).", :@cwd, "."],
-        ['-f', '--force', "Force the shutdown.", :@force, false],
+        ['-f', '--force', "Force the shutdown (kill -9).", :@force, false],
+        ['-w', '--wait SECONDS', "Wait SECONDS before forcing shutdown", :@wait, "0"],
         ['-P', '--pid FILE', "Where the PID file is located.", :@pid_file, "log/mongrel.pid"]
       ]
     end
@@ -191,7 +192,12 @@ module Mongrel
 
     def run
       if @force
-        Mongrel::send_signal("KILL", @pid_file)
+        @wait.to_i.times do |waiting|
+          exit(0) if not File.exist? @pid_file
+          sleep 1
+        end
+
+        Mongrel::send_signal("KILL", @pid_file) if File.exist? @pid_file
       else
         Mongrel::send_signal("TERM", @pid_file)
       end