From 20ed3e62b7e8f904bedc5d65a28b10b4148621d9 Mon Sep 17 00:00:00 2001 From: xxx Date: Wed, 1 Mar 2023 18:08:52 +0100 Subject: [PATCH] add check_instance_runtime warning --- quickemu-tools | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/quickemu-tools b/quickemu-tools index 915550f..3537228 100755 --- a/quickemu-tools +++ b/quickemu-tools @@ -648,6 +648,24 @@ if [[ $MultiInstanceError -gt 1 ]]; then fi +check_instance_runtime() { + + # https://www.qemu.org/docs/master/tools/qemu-img.html + + InstancePID="$(pgrep "$VM_InstanceName")" + + if [[ $InstancePID ]]; then + + printColor "\n\n WARNING snapshots operations should NOT be carried out when VM running \n\n" + + read -rp " Close down the VM, then press [enter] to continue > " + + fi + +} + +check_instance_runtime + # MAIN MENU (select VM then choose actions to do) while true ; do @@ -704,12 +722,14 @@ while true ; do elif [[ $MainMenuChoice == "sl" ]] ; then + check_instance_runtime function_snapshot_list printf "\n\n [enter] to return to menu \n\n " read -rp " > " elif [[ $MainMenuChoice == "sc" ]] ; then + check_instance_runtime function_snapshot_list printColor "\n\n Give [title] or [enter] for date.time [b] back to menu " SnapTitle= @@ -727,6 +747,8 @@ while true ; do elif [[ $MainMenuChoice == "sd" ]] ; then printColor "\n\n Quickemu-Tools Snapshot Deletion:" + + check_instance_runtime function_snapshot_list # Create range-selectable array @@ -803,6 +825,7 @@ while true ; do elif [[ $MainMenuChoice == "sa" ]] ; then + check_instance_runtime function_snapshot_list printColor "\n\n Give number of snapshot to use [enter] to return to menu " SnapNumber=