<div dir="ltr">Speaking off the top of my head, but does not lxc-stop send sigterm signal to all processes in a container, and then waits for configurable amount of time (default=60s), before sending sigkill?<div><br></div><div>If your processes expect to be shut down by init scripts that need to do some additional tasks, well, that will be the problem in this case.</div><div><br></div><div>lxc-shutdown is the second option, but you need to have your init configured properly to start regular shutdown process, if I am not mistaken.</div><div><br></div><div>Personally I use either lxc-stop or "halt" from within the container.</div><div>My rule of thumb is:</div><div>- use halt if container is unprivileged (as procedure is faster - less typing), or</div><div>- use lxc-stop if container is privileged.</div><div><br></div><div>(rule origin: I managed to kill the host once with improperly configured privileged container and a "halt" command, so there is that:).<br></div><div><br></div><div>b.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 November 2015 at 17:10, Alex Mestiashvili <span dir="ltr"><<a href="mailto:alex@biotec.tu-dresden.de" target="_blank">alex@biotec.tu-dresden.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Depending on the version of lxc, lxc-stop behaves differently.<br>
<br>
In the version I use, lxc-stop kills all the processes inside the<br>
container which can lead to problems if you run a database server for<br>
example.<br>
That's why there is a separate tool - lxc-shutdown which stops a<br>
container and waits for the processes to exit gracefully.<br>
In newer versions of lxc with lxc-stop one can reboot, cleanly shut<br>
down, or kill a container....<br>
<br>
Regards,<br>
Alex<br>
<div class="HOEnZb"><div class="h5"><br>
On 11/13/2015 04:30 PM, Saint Michael wrote:<br>
> Good question. I always use lxc-stop<br>
><br>
> On Fri, Nov 13, 2015 at 9:29 AM, Alex Mestiashvili <<br>
> <a href="mailto:alex@biotec.tu-dresden.de">alex@biotec.tu-dresden.de</a>> wrote:<br>
><br>
>> Hi All,<br>
>><br>
>> Is there a way to properly shutdown Jessie container on a Wheezy host ?<br>
>> lxc version is 0.8.0~rc1-8+deb7u2<br>
>><br>
>> lxc-shutdown -n $host which is basically<br>
>><br>
>> chroot /var/lib/lxc/${_CONTAINER}/rootfs telinit 0<br>
>><br>
>> ends up in:<br>
>><br>
>> "telinit: timeout opening/writing control channel /run/initctl"<br>
>><br>
>> with no change to the host.<br>
>><br>
>> Of course I can ssh/console to the container, run shutdown and then use<br>
>> lxc-stop to kill it, but may be there is a workaround for a direct<br>
>> shutdown ?<br>
>><br>
>> Thank you!<br>
>> _______________________________________________<br>
>> lxc-users mailing list<br>
>> <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
>> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> lxc-users mailing list<br>
> <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
><br>
<br>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></div></div></blockquote></div><br></div>