How to gracefuly shutdown a Spring Boot application by start-stop-daemon
<p>We have a multithreaded Spring Boot Application, which runs on Linux machine as a daemon. When I try to stop the application by start-stop-daemon like this</p>

<pre><code>start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
</code></pre>

<p>The SIGTERM signal is sent and application immetiately ends. However I want the application to wait, until every thread finishes it's work.</p>

<p>Is there any way, how to manage what happens, when SIGTERM signal is received?</p>