summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkos Chandras <hwoarang@gentoo.org>2015-09-05 08:06:10 +0100
committerMarkos Chandras <hwoarang@gentoo.org>2015-09-05 09:08:22 +0100
commit47806fd2a04808de420a72fa58ce89ef3c6c777f (patch)
tree8840852743257e5c8bcfc51bb22a13db919c6eb7 /app-emulation/lxc
parentnet-wireless/bluez: Version bump, don't install dbus conf file in /etc (#5580... (diff)
downloadgentoo-47806fd2a04808de420a72fa58ce89ef3c6c777f.tar.gz
gentoo-47806fd2a04808de420a72fa58ce89ef3c6c777f.tar.bz2
gentoo-47806fd2a04808de420a72fa58ce89ef3c6c777f.zip
app-emulation/lxc: Improve init script for shutting down containers. Bug #556826
Package-Manager: portage-2.2.20.1
Diffstat (limited to 'app-emulation/lxc')
-rw-r--r--app-emulation/lxc/files/lxc.initd.325
1 files changed, 2 insertions, 23 deletions
diff --git a/app-emulation/lxc/files/lxc.initd.3 b/app-emulation/lxc/files/lxc.initd.3
index c9ef99919922..092085400649 100644
--- a/app-emulation/lxc/files/lxc.initd.3
+++ b/app-emulation/lxc/files/lxc.initd.3
@@ -111,29 +111,8 @@ stop() {
return 0
fi
- init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }')
-
- if [ -z "${init_pid}" ]; then
- ewarn "${CONTAINER} doesn't seem to be running."
- return 0
- fi
-
- ebegin "Shutting down system in ${CONTAINER}"
- kill -PWR ${init_pid}
- eend $?
-
- TIMEOUT=${TIMEOUT:-30}
- i=0
- while [ -n "$(pgrep -P ${init_pid})" -a $i -lt ${TIMEOUT} ]; do
- sleep 1
- i=$(expr $i + 1)
- done
-
- if [ -n "${missingprocs}" ]; then
- ewarn "Something failed to properly shut down in ${CONTAINER}"
- fi
-
+ # 10s should be enough to shut everything down
ebegin "Stopping ${CONTAINER}"
- lxc-stop -n ${CONTAINER}
+ lxc-stop -t 10 -n ${CONTAINER}
eend $?
}