this is great stuff, thanks for sharing your script and to Daniel for the inotifywait trick; i've gotten it to work in my setup.
looking forward to a Just Works (kernel)? solution.... :-) but this is working splendidly, thanks again. On Mon, Jan 25, 2010 at 7:50 PM, Michael H. Warfield <[email protected]> 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 > >> This command can stay always there and it will trigger a lxc-stop when >> the container remains with 1 process. >> No polling and immediate :) >> At the first glance, it seems to work well, but of course not compatible >> with upstart. > > Oh BABY! I like. I like mucho! > > I've just cobbled together an "lcx-waiton-init" script that incorporates > that. After starting a container, running that script will monitor the > container and, if it reboots it, restart the container and continue > monitoring it, with a new log file (my peculiarity). If it halts, it > shuts the container down and terminates. It adds a double quiet option > and a timeout option to the inotifywait just in case. I'm going to > integrate that into my own startup wrapper scripts so it runs > automatically when a container is started. > > Mui Bien! Gracias! > > Attached. > > Mike > -- > Michael H. Warfield (AI4NB) | (770) 985-6132 | [email protected] > /\/\|=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! > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Lxc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/lxc-users > > ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Lxc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-users
