summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSteven Chamberlain <steven@pyro.eu.org>2014-11-13 13:41:27 +0000
committerHolger Levsen <holger@layer-acht.org>2014-11-14 13:47:02 +0100
commit90fff5f1bd9e20d86f5945c353e4662de5694344 (patch)
tree0f851612d7fb5b2a1215891d3b1b2ae2c734693b /bin
parent65cea15ad95db4aac4f2876514590c577ba4a7b5 (diff)
downloadjenkins.debian.net-90fff5f1bd9e20d86f5945c353e4662de5694344.tar.xz
g-i: try to stop qemu with SIGINT before SIGKILL
Diffstat (limited to 'bin')
-rw-r--r--bin/g-i-installation.sh11
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