Guest User

Untitled

a guest
Apr 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. while :; do
  4. stats=$(passenger-memory-stats | grep Rack)
  5. if [ "$stats" != "" ]; then
  6. echo $stats
  7. echo $stats | egrep --color=always 'MB ([12][0-9]|[3-9])..\.. MB'
  8. pid=$(echo $stats | egrep 'MB ([12][0-9]|[3-9])..\.. MB' | awk '{ print $1 }')
  9. if [ "$pid" != "" ]; then
  10. ps aux | grep $pid
  11. kill $pid && echo "$pid killed."
  12. fi
  13. echo "---"
  14. fi
  15. sleep 0.5
  16. done
Add Comment
Please, Sign In to add comment