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
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
The SIGTERM signal is sent and application immetiately ends. However I want the application to wait, until every thread finishes it's work.
Is there any way, how to manage what happens, when SIGTERM signal is received?