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
#!/usr/bin/env ruby | |
RAILS_CODE_PATH='/home/rahul/workspace/livia_portal_3/livia_portal/' | |
RAKE_PATH='/usr/local/rvm/gems/ree-1.8.7-2010.02@global/bin/rake' | |
USER="rahul" | |
case ARGV[0] | |
when "start" | |
STDOUT.puts "called start" | |
system "su - #{USER} -c \"cd #{RAILS_CODE_PATH} && #{RAKE_PATH} ts:rebuild\"" |
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. | |
NewerOlder