diff options
-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 |