Forces the (rails) application to gracefully terminate by sending a
TERM
signal to the process.
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 32 def graceful(pid) %xkill -s TERM #{pid}` end
Forces the (rails) application to terminate immediately by sending a -9 signal to the process.
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 38 def kill(pid) %xkill -9 #{pid}` end
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 48 def initialize(pid_path, pattern, keyword=nil) @pid_path, @pattern, @keyword = pid_path, pattern, keyword end
Searches for all processes matching the given keywords, and then invokes a specific action on each of them. This is useful for (e.g.) reloading a set of processes:
Killer.process(:reload, "/tmp/pids", "dispatcher.*.pid")
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 14 def process(action, pid_path, pattern, keyword) new(pid_path, pattern, keyword).process(action) end
Forces the (rails) application to reload by sending a HUP
signal to the process.
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 20 def reload(pid) %xkill -s HUP #{pid}` end
Force the (rails) application to restart by sending a USR2
signal to the process.
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 26 def restart(pid) %xkill -s USR2 #{pid}` end
Send a USR1
signal to the process.
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 43 def usr1(pid) %xkill -s USR1 #{pid}` end
Source: show
# File rails/railties/lib/commands/process/reaper.rb, line 52 def process(action) pids = find_processes if pids.empty? warn "Couldn't find any pid file in '#{@pid_path}' matching '#{@pattern}'" warn "(also looked for processes matching #{@keyword.inspect})" if @keyword else pids.each do |pid| puts "#{action.capitalize}ing #{pid}" self.class.send(action, pid) end delete_pid_files if terminating?(action) end end