[Lxc-users] How to make a container init DIE after finishing runlevel 0

Michael H. Warfield mhw at WittsEnd.com
Tue Jan 26 01:00:37 UTC 2010


On Tue, 2010-01-26 at 01:50 +0100, Daniel Lezcano wrote: 
> Michael H. Warfield wrote:
> > On Tue, 2010-01-26 at 00:42 +0100, Daniel Lezcano wrote:
> >
> >   
> >> I trick I just found:
> >>
> >>  while $(true); do
> >>     inotifywait /var/lib/lxc/debian/rootfs/var/run/utmp;
> >>     if [ "$(wc -l /cgroup/debian/tasks | awk '{ print $1 }')" = "1" ]; then
> >>         lxc-stop -n debian
> >>     fi;
> >> done
> >>     
> >
> > Seems to be a problem with that approach.  I'm not seeing anythign
> > in /var/lib/lxc/${VM}/rootfs any more.  Use to with 0.6.4 and earlier
> > but not now.  That seems to have "gone away".  That might have been a
> > way to get around that tmpfs problem but it's not there and I have to
> > resort back to the real rootfs.
> >   

> With a version > 0.6.4 the lxc-debian script write the rootfs in the 
> /var/lib/lxc/debian/rootfs.
> With a version <= 0.6.4 the rootfs is created in the current directory.

> Note if you have the source code from git, I incremented the version 
> right before the tag 0.6.5, so you may have a pre-0.6.5 but with the 
> 0.6.4 version information.

Ah!  If you look at that lxc-check script I had attached, it tries to
find the rootfs by looking up the config and then, if necessary,
dereferencing through any mount points for that rootfs that may be in
the VM fstab (part of my OpenVZ ve -> lxc conversion and compatiblity)
so I guess I've got that covered since I go for the ${ROOTFS}.  Try and
keep things as generic as possible.

Thanks for that clarification!

Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20100125/4bd1d9d8/attachment.pgp>


More information about the lxc-users mailing list