From c3f8c8d25c4309d3e06491090b5b53825010ac29 Mon Sep 17 00:00:00 2001 From: zedshaw Date: Mon, 14 Aug 2006 05:32:19 +0000 Subject: Now properly handles the PID from -c on stop/restart. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@324 19e92222-5c0b-0410-8929-a290d50e31e9 --- bin/mongrel_rails | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'bin') diff --git a/bin/mongrel_rails b/bin/mongrel_rails index d0bd9c0..9220000 100644 --- a/bin/mongrel_rails +++ b/bin/mongrel_rails @@ -165,20 +165,19 @@ class Stop < GemPlugin::Plugin "/commands" def configure options [ - ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil], + ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, "."], ['-f', '--force', "Force the shutdown.", :@force, false], ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"] ] end def validate - if @cwd - @cwd = File.expand_path(@cwd) - valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd" - end + @cwd = File.expand_path(@cwd) + valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd" - valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?" + Dir.chdir @cwd + valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?" return @valid end @@ -199,20 +198,19 @@ class Restart < GemPlugin::Plugin "/commands" def configure options [ - ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil], + ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, '.'], ['-s', '--soft', "Do a soft restart rather than a process exit restart", :@soft, false], ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"] ] end def validate - if @cwd - @cwd = File.expand_path(@cwd) - valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd" - end + @cwd = File.expand_path(@cwd) + valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd" - valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?" + Dir.chdir @cwd + valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?" return @valid end -- cgit v1.2.3-24-ge0c7