Created
June 11, 2016 01:19
-
-
Save xinuc/a960f980e40bef7324a01806350bc5f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| str = `passenger-memory-stats | grep "Passenger RubyApp" | grep MB | grep -v 'grep'` | |
| rows = str.split(/\n/) | |
| rows = rows.map {|s| s.gsub(/\s+/, ' ').gsub(/MB Passenger.*/, '').gsub(/ .* MB/, '')} | |
| rows = rows.select{|row| pid, mem = row.split(' '); mem.to_f > 1000 }.map{|row| row.split(' ').first} | |
| rows.each{|pid| puts "kill #{pid}"; `kill #{pid}` } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment