From 363c3ba2a158d7a41a67a90d690a0accf638f92b Mon Sep 17 00:00:00 2001 From: zedshaw Date: Sat, 16 Dec 2006 05:54:59 +0000 Subject: Wait parameter for stop --force which waits for the pid to go away, and then kill -9 after the wait time. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@472 19e92222-5c0b-0410-8929-a290d50e31e9 --- bin/mongrel_rails | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3-24-ge0c7