[lxc-devel] startup scripts for lxc containers?

Michael H. Warfield mhw at WittsEnd.com
Fri Jan 15 23:48:57 UTC 2010


On Fri, 2010-01-15 at 18:33 +0100, Daniel Lezcano wrote:

: - snip

> A work around would be to add in the latest shutdown script a write, for 
> example to a fifo, which is read from the parent's init process in order 
> to detect a shutdown. But we can not do the difference between a reboot 
> or a shutdown, that looks like a trick more than a real solution...

Better than the solution I'm currently using.  I'm just polling the
running containers (~ every 5 minutes) and if there's only 1 task
running AND the {VM}/var/run/utmp file is there and contains a valid
runlevel that ends in 0 or 6 then I shut the container down with
lxc-stop and restart it with lxc-start in the case of a reboot (ends in
6).  Yeah, ugly hack.  It would be slightly less ugly if it could be
event driven and not polling.

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-devel/attachments/20100115/e968f3e3/attachment.pgp>


More information about the lxc-devel mailing list