summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2013-11-16 00:50:15 -0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2013-11-16 00:50:15 -0200
commit604784b8ba4e8f699506977345010065fd6a6eea (patch)
tree16a30dd52ea0d46d2600b6805bdf78e8ec9a682a
parentfix FOREGROUND=vnc usage (diff)
downloadkvm-tools-604784b8ba4e8f699506977345010065fd6a6eea.tar.gz
kvm-tools-604784b8ba4e8f699506977345010065fd6a6eea.tar.bz2
kvm-tools-604784b8ba4e8f699506977345010065fd6a6eea.zip
do not try to kill daemon if it is dead
-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