blob: 6d3773f764e4e59a6d5646af77834abab4c6b2c4 (
plain) (
tree)
|
|
#!/bin/sh
cpu_count=4
low=25
high=75
icon=
icon_low=
icon_mid=
icon_high=
avg_load=$(uptime | cut -d, -f4 | cut -d: -f2)
percent=$(echo "result = $avg_load / $cpu_count * 100; scale=0; result / 1" | bc -l)
printf $icon
[ $percent -lt $low ] && printf $icon_low
[ $percent -ge $low ] && [ $percent -lt $high ] && printf $icon_mid
[ $percent -ge $high ] && printf $icon_high
printf " %s%%\n" $percent
|