diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2020-10-30 16:37:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2020-10-30 16:38:22 +0000 |
commit | 9005f8a27ffc7bff682b0e627eeaa76ef5bf95fb (patch) | |
tree | 49772d4fd9bf8ae7819e0244fd7289573c729448 /lib/container/stop | |
parent | Adding container run command to execute programs within containers. (diff) | |
download | compute-tools-9005f8a27ffc7bff682b0e627eeaa76ef5bf95fb.tar.xz compute-tools-9005f8a27ffc7bff682b0e627eeaa76ef5bf95fb.zip |
Cleaning up and harmonizing verbose output for container remove, restart, start, and stop commands.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'lib/container/stop')
-rwxr-xr-x | lib/container/stop | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lib/container/stop b/lib/container/stop index a299cb1..899f1a1 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -33,8 +33,8 @@ Parameters () { OPTIONS_ALL="" - GETOPT_LONGOPTIONS="name:,force,clean," - GETOPT_OPTIONS="n:,f," + GETOPT_LONGOPTIONS="name:,force,clean,verbose," + GETOPT_OPTIONS="n:,f,v," PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -69,6 +69,13 @@ Parameters () OPTONS_ALL="${OPTIONS_ALL} --clean" ;; + -v|--verbose) + VERBOSE="true" + shift 1 + + OPTIONS_ALL="${OPTIONS_ALL} --verbose" + ;; + --) shift 1 break @@ -84,7 +91,7 @@ Parameters () Usage () { - echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-v|--verbose]" >&2 exit 1 } @@ -122,12 +129,6 @@ case "${NAME}" in for NAME in ${NAMES} do - case "${VERBOSE}" in - true) - echo "Stopping container ${NAME}..." - ;; - esac - ${PROGRAM} stop --name ${NAME} ${OPTIONS_ALL} || true done @@ -253,6 +254,12 @@ case "${FORCE}" in esac # Run +case "${VERBOSE}" in + true) + echo -n "Stopping container ${NAME}..." + ;; +esac + machinectl ${MODE} ${NAME} case "${FORCE}" in @@ -266,6 +273,12 @@ case "${FORCE}" in ;; esac +case "${VERBOSE}" in + true) + echo " done." + ;; +esac + # Post hooks for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}" do |