diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-09 16:18:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-09 16:18:39 +0000 |
commit | 4abccc2c18bcc237324071298c0f6c75e14ef7c0 (patch) | |
tree | 3d7b8e5b300c926d51be6c4ae496c672f49156ab /lib/container/restart | |
parent | Releasing debian version 20201030-1. (diff) | |
download | open-infrastructure-compute-tools-4abccc2c18bcc237324071298c0f6c75e14ef7c0.tar.xz open-infrastructure-compute-tools-4abccc2c18bcc237324071298c0f6c75e14ef7c0.zip |
Merging upstream version 20210101.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | lib/container/restart | 35 |
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 |