summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorSimon Spöhel <simon@spoehel.ch>2023-08-24 14:24:18 +0000
committerSimon Spöhel <simon@spoehel.ch>2023-08-24 14:42:36 +0000
commitbf8972deffaf5732f824d772acbf98a4e0d69e81 (patch)
tree83365af2ac7d5da7cecf2304504fc65387e73a35 /libexec
parentBasic unifid start. (diff)
downloadcompute-tools-bf8972deffaf5732f824d772acbf98a4e0d69e81.tar.xz
compute-tools-bf8972deffaf5732f824d772acbf98a4e0d69e81.zip
Poor cnt stop for vms (by killing them).
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/stop16
1 files changed, 14 insertions, 2 deletions
diff --git a/libexec/container/stop b/libexec/container/stop
index 8ca98ce..06bf769 100755
--- a/libexec/container/stop
+++ b/libexec/container/stop
@@ -34,7 +34,7 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,force,interactive,kill,clean,stateless,verbose,"
+ GETOPT_LONGOPTIONS="name:,force,interactive,kill,clean,stateless,verbose,vm,"
GETOPT_OPTIONS="n:,f,i,k,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -99,6 +99,11 @@ Parameters ()
OPTIONS_ALL="${OPTIONS_ALL} --verbose"
;;
+ --vm)
+ VM="true"
+ shift 1
+ ;;
+
--)
shift 1
break
@@ -114,7 +119,7 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose] [--vm]" >&2
echo
echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
@@ -162,6 +167,13 @@ case "${NAME}" in
;;
esac
+case "${VM}" in
+ true)
+ systemctl stop "qemu@${NAME}.service" || exit 1
+ exit 0
+ ;;
+esac
+
if [ ! -e "${MACHINES}/${NAME}" ]
then
echo "'${NAME}': no such container" >&2