Created
May 22, 2019 05:39
-
-
Save reazul-islam/348dee241371ea187c070a6e3112018d to your computer and use it in GitHub Desktop.
Revisions
-
reazul-islam revised this gist
May 22, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ memtotal=$(free | grep Mem | awk '{ print $2 }') memuse=$(free | grep Mem | awk '{ print $3 }') let "memusepercent = $memuse * 100 / $memtotal " let "memtolerance = ($memtotal * 90)/100 " echo "MemTotal: $memtotal (Usage tolerance: $memtolerance )" echo "MemUsed: $memuse ($memusepercent %)" if [ $memuse -ge $memtolerance ]; then -
reazul-islam created this gist
May 22, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash memtotal=$(free | grep Mem | awk '{ print $2 }') memuse=$(free | grep Mem | awk '{ print $3 }') let "memusepercent = $memuse * 100 / $memtotal " let "memtolerance = $memtotal * 0.9 " echo "MemTotal: $memtotal (Usage tolerance: $memtolerance )" echo "MemUsed: $memuse ($memusepercent %)" if [ $memuse -ge $memtolerance ]; then echo "Memory use over 90%" pm2 restart all fi