aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx37
1 files changed, 36 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 7d8dbc2..3db4844 100755
--- a/kvmx
+++ b/kvmx
@@ -697,7 +697,28 @@ function kvmx_poweroff {
fi
kvmx_xephyr_stop
- sleep 3
+
+ let poweroff_attempts="0"
+ echo -n "Waiting for machine to stop..."
+ while true; do
+ kvmx_running || break
+
+ echo -n "."
+ let poweroff_attempts++
+
+ if [ "$poweroff_attempts" == "20" ]; then
+ echo "$BASENAME: guest $VM is still running"
+ echo "$BASENAME: please consider to stop it using \"kvmx $VM stop\""
+ #kvmx_stop
+ exit 1
+ fi
+
+ sleep 3
+ done
+ echo " done."
+ #sleep 3
+ #echo ""
+
kvmx_status
}
@@ -1276,6 +1297,20 @@ function kvmx_run {
kvmx_up $*
}
+# Restart machine
+function kvmx_restart {
+ if ! kvmx_running; then
+ echo "Guest $VM was not running, so starting it anyway..."
+ kvmx_start
+ else
+ echo "Powering off guest $VM..."
+ kvmx_poweroff
+
+ echo "Starting guest $VM again..."
+ kvmx_start
+ fi
+}
+
# Connect to the guest using VNC
function kvmx_vnc {
if ! kvmx_running; then