From 89c1c94543c0acddd4712a1828c33cd10e735ae1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 31 Mar 2017 07:22:25 -0300 Subject: Implements log dir and spice pid file --- kvmx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kvmx b/kvmx index d706669..7a5b3ed 100755 --- a/kvmx +++ b/kvmx @@ -125,11 +125,13 @@ function __kvmx_initialize { KVMX_PROJECT_FOLDER="`dirname $KVMXFILE`" STORAGE="`dirname $image`" STATE_DIR="$STORAGE/state/$VM" + LOG_DIR="$STORAGE/log" PIDFILE="$STATE_DIR/pid" PORTFILE="$STATE_DIR/port" SSHFILE="$STATE_DIR/ssh" - LOGFILE="$STATE_DIR/log" SPICEFILE="$STATE_DIR/spice" + LOGFILE="$LOG_DIR/qemu" + SPICELOG="$LOG_DIR/spice" if [ -e "$STORAGE/ssh/$VM.key" ]; then mkdir -p "$STORAGE/ssh" @@ -146,7 +148,7 @@ function __kvmx_initialize { __kvmx_ssh_command $SSHKEY - mkdir -p $STATE_DIR + mkdir -p $STATE_DIR $LOG_DIR if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "purge" ] && [ "$ACTION" != "destroy" ]; then echo "$BASENAME: file not found: $image" @@ -172,10 +174,13 @@ function kvmx_spice { fi # https://lists.freedesktop.org/archives/spice-devel/2013-September/014643.html - SPICE_NOGRAB=1 spicec --host localhost --port $PORT &> $SPICEFILE & + SPICE_NOGRAB=1 spicec --host localhost --port $PORT &> $SPICELOG & #spicy -h localhost -p $PORT #remote-viewer spice://localhost:$PORT + SPICEPID="$!" + echo "$SPICEPID" > $SPICEFILE + # Give time to connect sleep 5 @@ -703,8 +708,8 @@ function kvmx_log { logs="$logs $LOGFILE" fi - if [ -s "$SPICEFILE" ]; then - logs="$logs $SPICEFILE" + if [ -s "$SPICELOG" ]; then + logs="$logs $SPICELOG" fi tail -F $logs -- cgit v1.2.3