Flash lights on high usage

This commit is contained in:
Salt 2019-11-27 23:49:44 -06:00
parent e9cabb1c26
commit 31f1096027

View File

@ -33,14 +33,22 @@ loop-stats() {
# CPU stats on F1 and G6
g910-led -kn f1 $colorblue
if (( $(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)/($2+$4+$5)} END {print (usage > 0.75)}') )); then
if [ $(($(date +%s) % 2)) -eq 0 ]; then
g910-led -kn g6 $colorred
else
g910-led -kn g6 $colorbase
fi
else
g910-led -kn g6 $colorgreen
fi
# Memory stats on F2 and G7
g910-led -kn f2 $colormagenta
if (( $(free | grep Mem | awk '{print ($3/$2 > 0.75)}') )); then
if (( $(free | grep Mem | awk '{print ($3/$2 > 0.25)}') )); then
if [ $(($(date +%s) % 2)) -eq 0 ]; then
g910-led -kn g7 $colorred
else
g910-led -kn g7 $colorbase
fi
else
g910-led -kn g7 $colorgreen
fi