Class: Ap4r::Mongrel::Stop
- Includes:
- Command::Base
- Defined in:
- lib/ap4r/mongrel_ap4r.rb
Instance Method Summary collapse
Methods included from Command::Base
Instance Method Details
#configure ⇒ Object
162 163 164 165 166 167 168 169 |
# File 'lib/ap4r/mongrel_ap4r.rb', line 162 def configure [ ['-c', '--chdir PATH', "Change to dir", :@cwd, Dir.pwd], ['-P', '--pid FILE', "PID file", :@pid_file, "log/mongrel_ap4r.pid"], ['-f', '--force', "Force the shutdown (kill -9).", :@force, false], ['-w', '--wait SECONDS', "Wait SECONDS before forcing shutdown", :@wait, "0"], ] end |
#run ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/ap4r/mongrel_ap4r.rb', line 181 def run if @force @wait.to_i.times do |waiting| exit(0) if not File.exist? @pid_file sleep 1 end send_signal("KILL", @pid_file) if File.exist? @pid_file else send_signal("TERM", @pid_file) end end |
#validate ⇒ Object
171 172 173 174 175 176 177 178 179 |
# File 'lib/ap4r/mongrel_ap4r.rb', line 171 def validate @cwd = File.(@cwd) valid_dir? @cwd, "Path of chdir not valid: #@cwd " Dir.chdir(@cwd) valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file" return @valid end |