[lxc-users] Wildcard in lxd commands?

Mark Constable markc at renta.net
Thu Mar 17 14:07:11 UTC 2016


On 17/03/16 23:01, Janne Savikko wrote:
> You can not use filters to list running or stopped containers. Lxc
> start or stop do not support filters, only container name (or names).
> You though can always pipe commands if you want to stop dozens of
> containers whose names begin with "web" (note! lxc list keyword
> filter compares from the start of the name, so "lxc list eb" does not
> work in this case):
>
>
>    $ lxc list web|grep RUNNING|awk '{ print $2 }'|xargs lxc stop

It's still rather awkward to reliably script a start/stop of a single
container that happens to be called "web" when there might be web1,
web2 etc. An explicit non-filtered arg to lxc list with optional regex
would be more useful. Plus an option to have plain non-tablewriter
output for easier script parsing.

[[ `lxc list -cs web` = RUNNING ]]; echo $?



More information about the lxc-users mailing list