Add Containers

This commit is contained in:
Mattia Basaglia 2015-05-24 16:34:14 +02:00
parent 62ac481c37
commit c7977cd03f
2 changed files with 17 additions and 1 deletions

4
README
View file

@ -37,6 +37,10 @@ Config Variables:
* FSTYPE : file system type used to calculate disk usage (Uses df), * FSTYPE : file system type used to calculate disk usage (Uses df),
if empty it will show the total. if empty it will show the total.
Requirements:
* lsb-release for Dirstro
* lxc for Containers
Generating Images Generating Images
----------------- -----------------

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 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=
@ -103,6 +103,18 @@ function ponyget_Disk()
echo -e "$(pccolor $percent)$used\x1b[0m / $total" echo -e "$(pccolor $percent)$used\x1b[0m / $total"
} }
function ponyget_Containers()
{
local active="$(lxc-ls --active | wc -l)"
local total="$(lxc-ls | wc -l)"
local color=32
if [ "$active" -lt "$total" ]
then
color=31
fi
echo -e "\x1b[$color;1m$active\x1b[0m / $total active"
}
function bold() function bold()
{ {
echo -en "\x1b[1m${*}\x1b[22m" echo -en "\x1b[1m${*}\x1b[22m"