diff options
author | Steven Chamberlain <steven@pyro.eu.org> | 2014-11-13 13:41:27 +0000 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-11-14 13:47:02 +0100 |
commit | 90fff5f1bd9e20d86f5945c353e4662de5694344 (patch) | |
tree | 0f851612d7fb5b2a1215891d3b1b2ae2c734693b | |
parent | 65cea15ad95db4aac4f2876514590c577ba4a7b5 (diff) | |
download | jenkins.debian.net-90fff5f1bd9e20d86f5945c353e4662de5694344.tar.xz |
g-i: try to stop qemu with SIGINT before SIGKILL
-rw-r--r-- | bin/g-i-installation.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index 60223bdf..45bc0a87 100644 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -109,7 +109,16 @@ cleanup_all() { # # kill qemu # - sudo kill -9 $(ps fax | grep [q]emu-system | grep "vnc=$DISPLAY " 2>/dev/null | awk '{print $1}') || true + # use SIGINT for 10 seconds to encourage graceful shutdown + for i in $(seq 1 10); do + QEMU_PID=$(ps fax | grep [q]emu-system | grep "vnc=$DISPLAY " 2>/dev/null | awk '{print $1}') + [ -z "$QEMU_PID" ] && break + sudo kill -INT $QEMU_PID + sleep 1 + done + # force exit with SIGKILL if still running now + QEMU_PID=$(ps fax | grep [q]emu-system | grep "vnc=$DISPLAY " 2>/dev/null | awk '{print $1}') + [ -z "$QEMU_PID" ] || sudo kill -KILL $QEMU_PID sleep 0.3s # # save logs if there are any |