Created
February 11, 2011 05:08
-
-
Save rahul100885/821956 to your computer and use it in GitHub Desktop.
This script will kill a rails instance which is taking more than 500 MB and retsrat a request if it has served 100 requests
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 | |
while true; do | |
passenger-memory-stats | grep Rails:\ /home | awk ' { if($2 > 500) print "kill -9 " $1}' | bash | |
# above line will kill all the rails instances which are using memory more than 500MB | |
passenger-status | grep Processed: | awk ' { if($7 > 100) print "kill -6 " $3}' | bash | |
# above line will abort all rails instance who have processed 100 request. | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment