~ubuntu-branches/ubuntu/quantal/lxc/quantal-201208232243

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

set -e

if [ ! -x "$(which lxc-info 2>/dev/null)" ]
then
	echo "E: lxc-info - no such file" >&2
	exit 1
fi

for _STATUS in RUNNING FROZEN 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