diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-01-08 15:58:00 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-01-08 15:58:00 -0200 |
commit | 5a2b772cbb1fae985a3d88e35cea575b24758f29 (patch) | |
tree | 5a0d2980bf069c4eeb07fa53132ec9c139c48176 | |
parent | f23e888f9d2d669c8d97b0c71b11b716ca2a857c (diff) | |
download | kvmx-5a2b772cbb1fae985a3d88e35cea575b24758f29.tar.gz kvmx-5a2b772cbb1fae985a3d88e35cea575b24758f29.tar.bz2 |
Fixes kvmx_suspend and kvmx_status
-rwxr-xr-x | kvmx | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -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 |