aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-01-08 15:58:00 -0200
committerSilvio Rhatto <rhatto@riseup.net>2018-01-08 15:58:00 -0200
commit5a2b772cbb1fae985a3d88e35cea575b24758f29 (patch)
tree5a0d2980bf069c4eeb07fa53132ec9c139c48176
parentf23e888f9d2d669c8d97b0c71b11b716ca2a857c (diff)
downloadkvmx-5a2b772cbb1fae985a3d88e35cea575b24758f29.tar.gz
kvmx-5a2b772cbb1fae985a3d88e35cea575b24758f29.tar.bz2
Fixes kvmx_suspend and kvmx_status
-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