aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx23
1 files changed, 22 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index db7514c..65c81ea 100755
--- a/kvmx
+++ b/kvmx
@@ -172,7 +172,15 @@ function kvmx_spice {
# Bring virtual machine up
function kvmx_up {
- if kvmx_running; then
+ if kvmx_suspended; then
+ $DIRNAME/$BASENAME resume $VM
+
+ if [ "$run_spice_client" == "1" ]; then
+ $DIRNAME/$BASENAME spice $VM
+ fi
+
+ exit
+ elif kvmx_running; then
echo "$BASENAME: guest $VM is already running"
exit 1
fi
@@ -388,6 +396,19 @@ function kvmx_running {
return $?
}
+# Check if a guest is running
+function kvmx_suspended {
+ if ! kvmx_running; then
+ return 1
+ else
+ if ps -p $PID -o stat --no-headers | grep -q 'Tl'; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+}
+
# Resume the guest
function kvmx_resume {
if ! kvmx_running; then