Created
April 28, 2017 04:44
-
-
Save aalonzolu/c898f25a440a738662faeab3d0a338aa to your computer and use it in GitHub Desktop.
RAM % monitor, if > 95% kill some task
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
used=$(free | grep Mem | awk '{print $3/$2 * 100}'); #get % of ram used | |
used=${used%.*}; #conver to int | |
used=$(($used+8)); # add 8% because is returning a wrong number | |
echo $used; | |
if [ $used -gt 95 ]; then | |
killall chrome | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment