summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/lxc/files/lxc.initd')
-rw-r--r--app-emulation/lxc/files/lxc.initd14
1 files changed, 9 insertions, 5 deletions
diff --git a/app-emulation/lxc/files/lxc.initd b/app-emulation/lxc/files/lxc.initd
index 6266193031e6..7275826025a1 100644
--- a/app-emulation/lxc/files/lxc.initd
+++ b/app-emulation/lxc/files/lxc.initd
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.7 2011/09/14 19:39:40 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.8 2011/09/28 21:47:46 flameeyes Exp $
CONTAINER=${SVCNAME#*.}
@@ -111,15 +111,19 @@ stop() {
return 0
fi
- init_pid=$(head -n1 ${cgroupmount}/${CONTAINER}/tasks)
+ init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)
ebegin "Shutting down system in ${CONTAINER}"
kill -INT ${init_pid}
eend $?
- sleep 15
-
- missingprocs=$(pgrep -P ${init_pid})
+ TIMEOUT=${TIMEOUT:-30}
+ i=0
+ while [ -n "${missingprocs}" -a $i -lt ${TIMEOUT} ]; do
+ sleep 1
+ missingprocs=$(pgrep -P ${init_pid})
+ i=$(expr $i + 1)
+ done
if [ -n "${missingprocs}" ]; then
ewarn "Something failed to properly shut down in ${CONTAINER}"