From 9dfb6f87d0696fbf1930eda7d1957f52f2551988 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 27 May 2018 20:32:24 +0200 Subject: Adding 'ALL' as pseudo container name for container start, stop, restart, and remove commands to act on all available container respectivly. Signed-off-by: Daniel Baumann --- lib/container/stop | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/container/stop') diff --git a/lib/container/stop b/lib/container/stop index 5099005..d996282 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -30,6 +30,8 @@ CLEAN="false" Parameters () { + OPTIONS_ALL="" + GETOPT_LONGOPTIONS="name:,force,clean," GETOPT_OPTIONS="n:,f," @@ -53,12 +55,17 @@ Parameters () -f|--force) FORCE="true" + shift 1 + + OPTIONS_ALL="${OPTIONS_ALL} --force" ;; --clean) # internal option CLEAN="true" shift 1 + + OPTONS_ALL="${OPTIONS_ALL} --clean" ;; --) @@ -108,6 +115,19 @@ then Usage fi +case "${NAME}" in + ALL) + NAMES="$(container list --format shell --started)" + + for NAME in ${NAMES} + do + container stop --name ${NAME} ${OPTIONS_ALL} || true + done + + exit 0 + ;; +esac + if [ ! -e "${MACHINES}/${NAME}" ] then echo "'${NAME}': no such container" >&2 -- cgit v1.2.3