summaryrefslogtreecommitdiffstats
path: root/lib/container/restart
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlib/container/restart33
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/container/restart b/lib/container/restart
index f78cfff..83859e2 100755
--- a/lib/container/restart
+++ b/lib/container/restart
@@ -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