mirror of
https://gitlab.com/mattia.basaglia/ASCII-Pony.git
synced 2024-11-21 19:57:59 +01:00
Add swap
This commit is contained in:
parent
e4092ed7fa
commit
78f99b2d51
1 changed files with 17 additions and 2 deletions
19
systempony
19
systempony
|
@ -4,7 +4,7 @@
|
|||
# Name of the pony
|
||||
PONY=random
|
||||
# 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)
|
||||
FSTYPE=
|
||||
|
||||
|
@ -42,7 +42,7 @@ function ponyget_RAM()
|
|||
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 ramtable=$(free -m)
|
||||
ramtable=$(free -m)
|
||||
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)
|
||||
let percent="$used_M * 100 / $total_M"
|
||||
|
@ -51,6 +51,21 @@ function ponyget_RAM()
|
|||
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()
|
||||
{
|
||||
uname -r -m
|
||||
|
|
Loading…
Reference in a new issue