summaryrefslogtreecommitdiffstats
path: root/lib/container/restart
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-09 16:18:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-09 16:18:22 +0000
commitc011654fff348560957804ce4db060b8f1b40f89 (patch)
tree9065f9029812e692f8ed9c6d6696e58a624ff29c /lib/container/restart
parentAdding upstream version 20201030. (diff)
downloadopen-infrastructure-compute-tools-c011654fff348560957804ce4db060b8f1b40f89.tar.xz
open-infrastructure-compute-tools-c011654fff348560957804ce4db060b8f1b40f89.zip
Adding upstream version 20210101.upstream/20210101
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/container/restart')
-rwxr-xr-xlib/container/restart35
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/container/restart b/lib/container/restart
index f78cfff..3c84f4d 100755
--- a/lib/container/restart
+++ b/lib/container/restart
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2020 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -30,8 +30,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,"
- GETOPT_OPTIONS="n:,"
+ GETOPT_LONGOPTIONS="name:,verbose,"
+ GETOPT_OPTIONS="n:,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -51,6 +51,13 @@ Parameters ()
shift 2
;;
+ -v|--verbose)
+ VERBOSE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --verbose"
+ ;;
+
--)
shift 1
break
@@ -66,7 +73,7 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-v|--verbose]" >&2
exit 1
}
@@ -83,13 +90,7 @@ case "${NAME}" in
for NAME in ${NAMES}
do
- case "${VERBOSE}" in
- true)
- echo "Restarting container ${NAME}..."
- ;;
- esac
-
- ${PROGRAM} restart --name ${NAME} || true
+ ${PROGRAM} restart --name ${NAME} ${OPTIONS_ALL} || true
done
exit 0
@@ -112,8 +113,20 @@ do
done
# Run
+case "${VERBOSE}" in
+ true)
+ echo -n "Restarting container ${NAME}..."
+ ;;
+esac
+
machinectl reboot ${NAME}
+case "${VERBOSE}" in
+ true)
+ echo " done."
+ ;;
+esac
+
# Post hooks
for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
do