summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-init-script14
1 files changed, 9 insertions, 5 deletions
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index e8ca078..1940a4b 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -222,11 +222,15 @@ stop() {
fi
ebegin "Stopping ${VM_BINARY##*/} for ${VMNAME}"
- start-stop-daemon --stop "${VM_BINARY}" \
- --user "${DROP_USER}" \
- --pidfile "${PIDFILE}" \
- --quiet
- eend $?
+ if kill -0 "${pid}" > /dev/null 2>&1; then
+ start-stop-daemon --stop "${VM_BINARY}" \
+ --user "${DROP_USER}" \
+ --pidfile "${PIDFILE}" \
+ --quiet
+ eend $?
+ else
+ eend 0 # no need to kill process if it is dead :P
+ fi
local qtap
[ -s "${QTAP_FILE}" ] && qtap=$(cat "${QTAP_FILE}")
if [ -n "$qtap" ]; then