summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-10-25 13:54:57 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-11-06 08:33:46 +0000
commit9150b56d098f6043c3f1570da5531ed10586784a (patch)
tree30fdb621c559910a8b47c46091a109f0a7bdf75b
parentReadding container rename command. (diff)
downloadcompute-tools-9150b56d098f6043c3f1570da5531ed10586784a.tar.xz
compute-tools-9150b56d098f6043c3f1570da5531ed10586784a.zip
Readding -f|--force option in container stop command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xlib/container/stop20
-rw-r--r--share/man/container-stop.1.txt6
2 files changed, 23 insertions, 3 deletions
diff --git a/lib/container/stop b/lib/container/stop
index ba8960d..ec24d51 100755
--- a/lib/container/stop
+++ b/lib/container/stop
@@ -27,8 +27,8 @@ CLEAN="false"
Parameters ()
{
- LONG_OPTIONS="name:,clean,"
- OPTIONS="n:,"
+ LONG_OPTIONS="name:,force,clean,"
+ OPTIONS="n:,f,"
PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})"
@@ -48,6 +48,10 @@ Parameters ()
shift 2
;;
+ -f|--force)
+ FORCE="true"
+ ;;
+
--clean)
# internal option
CLEAN="true"
@@ -166,5 +170,15 @@ case "${STATE}" in
;;
esac
+case "${FORCE}" in
+ true)
+ MODE="terminate"
+ ;;
+
+ *)
+ MODE="poweroff"
+ ;;
+esac
+
# Run
-machinectl poweroff ${NAME}
+machinectl ${MODE} ${NAME}
diff --git a/share/man/container-stop.1.txt b/share/man/container-stop.1.txt
index 8b864d6..7531f1c 100644
--- a/share/man/container-stop.1.txt
+++ b/share/man/container-stop.1.txt
@@ -44,12 +44,18 @@ The following container options are available:
*-n, --name='NAME'*::
Specify container name.
+*-f, --force*::
+ Instead of running the proper shutdown sequence, terminate all processes of the container imediatly.
+
EXAMPLES
--------
*Shutdown example.net container:*::
sudo container stop -n example.net
+*Immediately stop example.net container:*::
+ sudo container stop -n example.net -f
+
SEE ALSO
--------