Improve CPU_Usage formatting

This commit is contained in:
Mattia Basaglia 2016-04-22 20:14:26 +01:00
parent e10ea10782
commit 1434ccf47a
2 changed files with 2 additions and 1 deletions

1
README
View file

@ -43,6 +43,7 @@ Config Variables:
Requirements:
* lsb-release for Distro
* lxc for Containers
* bc for CPU_Usage
Generating Images
-----------------

View file

@ -83,7 +83,7 @@ function ponyget_CPU()
function ponyget_CPU_Usage()
{
echo "$(top -b -n1 | grep "Cpu(s):" | sed -r -e "s/^[^0-9]+//" -e "s/[^0-9]+,\s+/ + /g" -e "s/[^0-9]+$//" | cut -d ' ' -f 1-5 | bc)%"
printf %.1f%% "$(top -b -n1 | grep "Cpu(s):" | sed -r -e "s/^[^0-9]+//" -e "s/[^0-9]+,\s+/ + /g" -e "s/[^0-9]+$//" | cut -d ' ' -f 1-5 | bc)"
}
function ponyget_Uptime()