[Lxc-users] small improvement to lxc scripts
Papp Tamas
tompos at martos.bme.hu
Fri Jun 15 13:27:13 UTC 2012
On 06/14/2012 11:40 PM, -- NeoX -- wrote:
> #!/bin/bash
> [...custom script...]
In Ubuntu 12.04 there is a custom script called lxc-list:
#!/bin/sh
set -e
if [ ! -x "$(which lxc-info 2>/dev/null)" ]
then
echo "E: lxc-info - no such file"
exit 1
fi
for _STATUS in RUNNING STOPPED
do
echo ${_STATUS}
for _CONTAINER in $(lxc-ls | sort -u)
do
if lxc-info -n ${_CONTAINER} 2>&1 | grep -qs "${_STATUS}"
then
echo -n " ${_CONTAINER}"
if [ -e /etc/lxc/auto/${_CONTAINER} ] ||
[ -e /etc/lxc/auto/${_CONTAINER}.conf ]
then
echo " (auto)"
else
echo
fi
fi
done
echo
done
tamas
More information about the lxc-users
mailing list