<div dir="ltr">Thank you for your answer, I made a little experiment to show my point:<div><br></div><div>I made a simple script:</div><div><br></div><div>-----------------------------------------------------------------------</div>
<div>







<p class="">#!/bin/bash</p>
<p class="">function cleanup () {</p>
<p class="">  while true</p>
<p class="">  do</p>
<p class="">    sleep 0.1;</p>
<p class="">    echo "sigint received" >> /home/ubuntu/shutdown.txt;</p>
<p class="">  done</p>
<p class="">}</p>
<p class="">trap cleanup SIGHUP SIGINT SIGTERM</p>
<p class="">sleep 2000</p></div><div>-----------------------------------------------------------------------<br></div><div><br></div><div>This script is launched using an upstart script. Basically, it listens for the SIGINT signal and when received it output something in a file. The upstart script to launch it is simple:</div>
<div><br></div><div>----------------------------------------------------------------------</div><div>







<p class="">description     "testing shutdown behaviour"</p>
<p class="">kill timeout 100</p>
<p class=""><span class="">     </span>exec bash /home/ubuntu/shutdown.sh</p></div><div>-----------------------------------------------------------------------</div><div><br></div><div>When I start this script and stop it manually (sudo stop shutdowntesting), I see that a SIGINT signal is being trapped (for 100 seconds). However, when I do not stop it manually but rather shutdown the entire container (using lxc-shutdown), I don't see any SIGINT trapped, that is why I assume this process is not stopped gracefully.</div>
<div><br></div><div>Let me know if I'm not clear,</div><div>Thanks for your help.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-19 18:25 GMT+01:00 Tamas Papp <span dir="ltr"><<a href="mailto:tompos@martos.bme.hu" target="_blank">tompos@martos.bme.hu</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On 03/19/2014 06:21 PM, Robin Monjo wrote:<br>
> Hello,<br>
><br>
> I'm using LXC 0.7.5 with the stock ubuntu template. My containers are<br>
> running ruby processes that are managed by upstart (launched by<br>
> upstart scripts).<br>
><br>
> I need these processes to be gracefully stopped when shutting down a<br>
> container, i.e send the SIGTERM signal and wait for it to be done<br>
> before fully shutting down my container.<br>
><br>
> I see that inside a container, upstart listen for the SIPWR signal and<br>
> execute "shutdown -h now "SIGPWR received"", is it safe to remove this<br>
> in order to achieve my goal ? Or is there any other alternatives ?<br>
<br>
<br>
</div></div>If you send sigpwr, it stops services gracefully.<br>
If you remove that, it doesn't.<br>
<br>
So what do you want exactly? I may misunderstand something.<br>
<br>
tamas<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" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
</blockquote></div><br></div>