[Lxc-users] lxc-start at boot

Michael H. Warfield mhw at WittsEnd.com
Sun Jun 26 19:47:20 UTC 2011


On Sun, 2011-06-26 at 17:46 +0300, Mihamina Rakotomandimby wrote: 
> Hi all,

> I usually launch my containers with 'sudo lxc-start -n <name>'.
> The problem with this is the fact it doesn't get my back to a shell
> prompt.
> To have what I want, I have to workarround, with screen or end the
> command line with '&'.

> More globally, if the containers configuration files are all stored
> in /etc/lxc/, with the basename same as the container name, How to
> make /etc/lxc/ scanned for '*.conf' file and then all VMs started?

> If it's  necessary, I'm running Debian Squeeze.

I've got a fairly complex script I use to fire up containers modeled
largely on the OpenVZ model.  The problem here is that you may want
containers to start at boot and ones you DON'T want to start at boot.
You may also have experimental containers you want set up and configured
but will only started if you force them.  You'll also discover that a
little "load leveling" helps if you think you are going to fire up 3
dozen VM's all at once.  You'll find out rapidly that it's not a good
idea to just start everything blindly for a number of reasons.

I have some parameters I add to the configuration files (commented out
if running stock code) like this:

lxc-boot.onboot = yes
lxc-boot.disabled = no

These correspond directly with the equivalent OpenVZ features.

Then I have a script (which still needs a lot of cleanup) which will go
through all the configuration files and start VM's.  If it's started
with a -b option (boot time) it will only start VM's that are set to:

".onboot = yes".

If you run it manually, you can start one or more VM's but only if they
are NOT disabled.  A -f option will "force" firing up disabled VM's but
only one at a time.

When it starts a container, it dumps the output to a log file and forks
it off as it's own process.

The script use to use the iowait trick to restart containers and, now
that's part of the base binaries, that's what needs cleaning up now.
But this is all "high level" management stuff that needs to be looked at
and decided upon.

Maybe, one of these days, I'll finish cleaning it up and send it to
Daniel.


Regards,
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/20110626/1e22fe3a/attachment.pgp>


More information about the lxc-users mailing list