1 |
flameeyes 11/09/28 21:47:46 |
2 |
|
3 |
Modified: lxc.initd |
4 |
Log: |
5 |
Fix init script to find the correct PID for the container's init and use a 30-seconds timeout to see if it has stopped correctly. Thanks to Stef Simoens for both (bug #384265). |
6 |
|
7 |
(Portage version: 2.2.0_alpha59/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.8 app-emulation/lxc/files/lxc.initd |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?rev=1.8&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?rev=1.8&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd?r1=1.7&r2=1.8 |
15 |
|
16 |
Index: lxc.initd |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v |
19 |
retrieving revision 1.7 |
20 |
retrieving revision 1.8 |
21 |
diff -u -r1.7 -r1.8 |
22 |
--- lxc.initd 14 Sep 2011 19:39:40 -0000 1.7 |
23 |
+++ lxc.initd 28 Sep 2011 21:47:46 -0000 1.8 |
24 |
@@ -1,7 +1,7 @@ |
25 |
#!/sbin/runscript |
26 |
# Copyright 1999-2011 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.7 2011/09/14 19:39:40 flameeyes Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.8 2011/09/28 21:47:46 flameeyes Exp $ |
30 |
|
31 |
CONTAINER=${SVCNAME#*.} |
32 |
|
33 |
@@ -111,15 +111,19 @@ |
34 |
return 0 |
35 |
fi |
36 |
|
37 |
- init_pid=$(head -n1 ${cgroupmount}/${CONTAINER}/tasks) |
38 |
+ init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2) |
39 |
|
40 |
ebegin "Shutting down system in ${CONTAINER}" |
41 |
kill -INT ${init_pid} |
42 |
eend $? |
43 |
|
44 |
- sleep 15 |
45 |
- |
46 |
- missingprocs=$(pgrep -P ${init_pid}) |
47 |
+ TIMEOUT=${TIMEOUT:-30} |
48 |
+ i=0 |
49 |
+ while [ -n "${missingprocs}" -a $i -lt ${TIMEOUT} ]; do |
50 |
+ sleep 1 |
51 |
+ missingprocs=$(pgrep -P ${init_pid}) |
52 |
+ i=$(expr $i + 1) |
53 |
+ done |
54 |
|
55 |
if [ -n "${missingprocs}" ]; then |
56 |
ewarn "Something failed to properly shut down in ${CONTAINER}" |