Skip to content

Commit f2b5021

Browse files
authored
Update 15-system
Replaced Load with CPU avg usage percentage
1 parent 5f4c00f commit f2b5021

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

update-motd.d/15-system

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ uptime="$uptime $(color $dimInfoColor "» $(date -d "@"$(grep btime /proc/stat |
5656
label3="$uptime"
5757
label3="$(color $statsLabelColor "Uptime") $(color $bulletColor "··")$(color $statsLabelColor "") $(color $infoColor "$label3")"
5858

59-
label4="$(awk '{print $1}' /proc/loadavg)"
60-
label4="$(color $statsLabelColor "Load") $(color $bulletColor "···")$(color $statsLabelColor "") $(color $infoColor $label4)"
59+
label4="$(awk -v a="$(awk '/cpu /{print $2+$3+$4+$5+$6+$7+$8+$9+$10,$5}' /proc/stat; sleep 0.3)" '/cpu /{split(a,b," "); printf "%.1f%%", 100*(($2+$3+$4+$5+$6+$7+$8+$9+$10-b[1])-($5-b[2]))/($2+$3+$4+$5+$6+$7+$8+$9+$10-b[1])}' /proc/stat)"
60+
label4="$(color $statsLabelColor "Cpu") $(color $bulletColor "····")$(color $statsLabelColor "") $(color $infoColor $label4)"
6161

6262
label5="$(df -h ~ | awk 'NR==2 { printf "%sB / %sB \\e[38;5;144m» Free: %sB\\e[0m",$3,$2,$4; }')"
6363
label5="$(color $statsLabelColor "Disk") $(color $bulletColor "····")$(color $statsLabelColor "") $(color $infoColor "$label5")"

0 commit comments

Comments
 (0)