aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx22
1 files changed, 16 insertions, 6 deletions
diff --git a/kvmx b/kvmx
index e30d025..4072d03 100755
--- a/kvmx
+++ b/kvmx
@@ -625,10 +625,16 @@ function kvmx_suspend {
# Alternative
#kvmx_monitor stop
- SPICEPID="`cat $SPICEFILE`"
+ if [ -e "$SPICEFILE" ]; then
+ SPICEPID="`cat $SPICEFILE`"
- if ps $SPICEPID &> /dev/null; then
- kill $SPICEPID
+ if [ -z "$SPICEPID" ]; then
+ return
+ fi
+
+ if ps $SPICEPID &> /dev/null; then
+ kill $SPICEPID
+ fi
fi
}
@@ -1219,13 +1225,17 @@ function kvmx_list_image {
# Print guest status
function kvmx_status {
- if kvmx_running; then
+ if kvmx_suspended; then
+ echo "$BASENAME: $VM guest is suspended"
+ elif kvmx_running; then
echo "$BASENAME: $VM guest is running"
- PID="`cat $PIDFILE`"
- ps $PID
else
echo "$BASENAME: $VM guest is stopped"
+ return
fi
+
+ PID="`cat $PIDFILE`"
+ ps $PID
}
# Print guest log