This commit is contained in:
Mattia Basaglia 2016-01-02 13:22:14 +00:00
parent e4092ed7fa
commit 78f99b2d51

View file

@ -4,7 +4,7 @@
# Name of the pony # Name of the pony
PONY=random PONY=random
# What info to show (must have a function defined as ponyget_* to work) # What info to show (must have a function defined as ponyget_* to work)
INFO=(User Hostname Distro Kernel Uptime Load Shell Packages RAM Disk) INFO=(User Hostname Distro Kernel Uptime Load Shell Packages RAM Swap Disk)
# File system type to show disk usage (default/empty=all) (see df for specific values) # File system type to show disk usage (default/empty=all) (see df for specific values)
FSTYPE= FSTYPE=
@ -42,7 +42,7 @@ function ponyget_RAM()
local used=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3) local used=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
local total=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2) local total=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
local ramtable=$(free -m) ramtable=$(free -m)
local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3) local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2) local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
let percent="$used_M * 100 / $total_M" let percent="$used_M * 100 / $total_M"
@ -51,6 +51,21 @@ function ponyget_RAM()
echo -e "$(pccolor $percent)$used\x1b[0m / $total" echo -e "$(pccolor $percent)$used\x1b[0m / $total"
} }
function ponyget_Swap()
{
local swaptable=$(free -h | grep Swap)
local used=$(echo "$swaptable" | sed -r "s/ +/\t/g" | cut -f 3)
local total=$(echo "$swaptable" | sed -r "s/ +/\t/g" | cut -f 2)
swaptable=$(free -m | grep Swap)
local used_M=$(echo "$swaptable" | sed -r "s/ +/\t/g" | cut -f 3)
local total_M=$(echo "$swaptable" | sed -r "s/ +/\t/g" | cut -f 2)
let percent="$used_M * 100 / $total_M"
echo -e "$(pccolor $percent)$used\x1b[0m / $total"
}
function ponyget_Kernel() function ponyget_Kernel()
{ {
uname -r -m uname -r -m