[Lxc-users] Best way to shutdown a container
Brian K. White
brian at aljex.com
Tue Aug 17 17:35:08 UTC 2010
On 8/17/2010 11:43 AM, Gordon Henderson wrote:
> On Fri, 13 Aug 2010, Clemens Perz wrote:
>
>> Hi!
>>
>> I used to run lxc-stop on my system containers when I actually want to
>> run a halt. Only today I noticed, that stop actually kills all
>> processes, not really doing a halt. I went through the lxc commands and
>> did not find something graceful to do this job from the host systems
>> shutdown scripts.
>>
>> Did I miss it? Maybe lxc-halt is a missing piece ;-) Is there a simple
>> way to do it, preventing the need to login to the container and run halt?
>
> Am I the only one using lxc-watchdog by Dobrica Pavlinusic ?
>
> http://blog.rot13.org/2010/03/lxc-watchdog_missing_bits_for_openvz_-_linux_containers_migration.html
>
> I've had to tweak it a bit for my own setup, but otherwise it seems to
> work OK.
>
> It modified a containers inittab at start time and then sends a powerfail
> event to it's running init to simulate a reboot...
>
> Gordon
Have you not read the various posts in this thread?
That is essentially what everyone already does.
Everyone has their own slight twist on the scripts and packaging,
including that one, including myself (on openSUSE where I put some
scripts and setup logic into an rpm with lxc-tools and a wiki page to
document it), but they all do exactly that same thing, based off a
couple posts to this list a while back when someone first came up with
the init idea and somene else came up with the inotify enhancement. They
don't all actually modify the containers init automatically, but neither
do I agree that that is necessarily correct. It's a handy twist, but a
trivial detail on top of everything else.
In my case, although my scripts could be enhanced a lot, rather than
enhance them further I'm living with them for now since they do work (in
production), and when I'm ready to upgrade to the new lxc with built-in
watchdog/agent, I'll invest in that for further enhancements.
--
bkw
More information about the lxc-users
mailing list