Created
May 7, 2015 21:27
-
-
Save sideshowcoder/071f601d38cf2de61abd 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
| MAX_MEM=50000 | |
| for pid in $(ps ax|grep 'unicorn_rails worker'|awk 'NR>1 {print l} {l=$1}'); do | |
| test $(cat "/proc/$pid/status" | grep "VmSize:" | sed -re s,VmSize:\\s+,, | cut -d" " -f1) -gt $MAX_MEM && kill -QUIT $pid | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment