Skip to content

Commit e9b4044

Browse files
authored
Merge pull request ruanyf#9 from B-kay/patch-1
Create cpu.sh
2 parents 8fb30e4 + c40fe92 commit e9b4044

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/cpu.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MAX=95
2+
3+
4+
USE=`grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage ""}'`
5+
if [ $USE -gt $MAX ]; then
6+
echo "Percent used: $USE" | mail -s "Running out of CPU power" $EMAIL
7+
fi

0 commit comments

Comments
 (0)