Switch to SIGTERM for graceful shutdown in startup.sh
Replaced the `curl` HTTP shutdown call with a `kill -TERM` signal to ensure the JVM shutdown hook executes cleanly. Added a `wait` command to block until the process finishes, enabling a more reliable and proper termination process.
This commit is contained in:
1 parent
e0ec43813d
commit
1f126f29ad
1 file changed
+4
-3
+4
-3
@@ -6,9 +6,10 @@ _term() {
|
||||
echo "Bot isn't running, exiting."
|
||||
exit 0
|
||||
else
|
||||
/usr/bin/curl --no-progress-meter http://localhost:"$API_PORT"/actions/shutdown
|
||||
echo "Waiting 2 seconds for bot shutdown"
|
||||
sleep 2
|
||||
# SIGTERM triggers the JVM shutdown hook (App.shutdown); wait until it has finished.
|
||||
kill -TERM "$pid" 2>/dev/null
|
||||
wait "$pid"
|
||||
exit $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user