[lxc-users] Ubuntu container upstart and graceful shutdown

Serge Hallyn serge.hallyn at ubuntu.com
Wed Mar 19 18:14:01 UTC 2014


Quoting Michael H. Warfield (mhw at WittsEnd.com):
> On Wed, 2014-03-19 at 18:21 +0100, Robin Monjo wrote:
> > Hello,
> > 
> > 
> > I'm using LXC 0.7.5 with the stock ubuntu template. My containers are
> > running ruby processes that are managed by upstart (launched by
> > upstart scripts). 
> > 
> > 
> > I need these processes to be gracefully stopped when shutting down a
> > container, i.e send the SIGTERM signal and wait for it to be done
> > before fully shutting down my container.
> > 
> > 
> > I see that inside a container, upstart listen for the SIPWR signal and
> > execute "shutdown -h now "SIGPWR received"", is it safe to remove this
> > in order to achieve my goal ? Or is there any other alternatives ?
> 
> Ok...  So, why not use a SIGPWR?  That's the convention.  Are you
> married to using SIGTERM for this purpose?  I'm just getting ready to
> make sure the Fedora and CentOS templates adhere to the SIGPWR
> convention for both Upstart and Systemd.  Why SIGTERM now?
> 
> And the simple answer to your question is "no, it is not safe - it will
> cause other timeouts, delays, and problems".

Since you're using upstart, why not just put

	stop on starting rc RUNLEVEL=[016]

in the upstart job?


More information about the lxc-users mailing list