Created
May 15, 2012 12:28
-
-
Save dip00dip/2701387 to your computer and use it in GitHub Desktop.
kill all leaking rails processes runnning via passenger
This file contains 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
# every 5 minutes run this script ↓ | |
*/12 * * * * /path/to/kill_memleaked_rails.sh |
This file contains 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
#!/bin/sh | |
# Kill every passenger spawned rails instance with more than 350M memory usage | |
# don't forget to chmod+x on this file | |
# put it to /usr/local/bin or your rails user homedir i.e ~/bin/ | |
for i in `passenger-memory-stats |grep current|awk '{if ($2 > 350) print $1}'` ; do kill -9 $i; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your simple
grep
intoawk
slays me. :(