From 1f126f29ad303d96956d82bacb352a878b83f1fa Mon Sep 17 00:00:00 2001 From: anthorob Date: Fri, 9 Oct 2026 12:51:35 -0400 Subject: [PATCH] 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. --- startup.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/startup.sh b/startup.sh index 3a9b0af..d06214a 100644 --- a/startup.sh +++ b/startup.sh @@ -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 }