Browse files

Add support for RVM

  • Loading branch information...
1 parent 0297766 commit d79ba4820ef3e89945fcea4bb1cb6c8902371b79 valery committed with Mar 14, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −0 Readme.md
  2. +1 −0 bin/zombie_passenger_killer
  3. +2 −1 lib/zombie_passenger_killer/reaper.rb
View
1 Readme.md
@@ -28,6 +28,7 @@ Usage
-i, --interval [SECONDS] Check every SECONDS (default: 10)
-p, --pattern [PATTERN] Find processes with this pattern (default: ' Rack: ')
-1, --once Check once and exit
+ --rvmsudo Use `rvmsudo` to see passenger-status
-h, --help Show this
-v, --version Show Version
-t, --time Show time in output
View
1 bin/zombie_passenger_killer
@@ -22,6 +22,7 @@ BANNER
opts.on("-i", "--interval [SECONDS]", Integer, "Check every SECONDS (default: 10)") {|i| options[:interval]=i }
opts.on("-p", "--pattern [PATTERN]", String, "Find processes with this pattern (default: ' Rack: ')") {|i| options[:pattern]=i }
opts.on("-1", "--once", "Check once and exit") { options[:once]=true }
+ opts.on("--rvmsudo", "Use `rvmsudo` to see passenger-status") { options[:rvmsudo]=true }
opts.on("-h", "--help","Show this") { puts opts; exit }
opts.on("-v", "--version","Show Version"){ puts version; exit }
opts.on("-t", "--timing","Show timing on output") { options[:show_times]=true }
View
3 lib/zombie_passenger_killer/reaper.rb
@@ -14,6 +14,7 @@ def initialize(options)
@interval = options[:interval] || 10
@strace_time = 5
@out = STDOUT
+ @rvmsudo = options[:rvmsudo]
end
def lurk
@@ -64,7 +65,7 @@ def hunt_zombies
# return array of pids reported from passenger-status command, nil if passenger-status doesn't run
def passenger_pids
- pids = %x(passenger-status|grep PID).split("\n").map { |x| x.strip.match(/PID: \d*/).to_s.split[1].to_i }
+ pids = %x(#{'rvmsudo ' if @rvmsudo}passenger-status|grep PID).split("\n").map { |x| x.strip.match(/PID: \d*/).to_s.split[1].to_i }
pids if $?.exitstatus.zero?
end

0 comments on commit d79ba48

Please sign in to comment.