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."
|
echo "Bot isn't running, exiting."
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
/usr/bin/curl --no-progress-meter http://localhost:"$API_PORT"/actions/shutdown
|
# SIGTERM triggers the JVM shutdown hook (App.shutdown); wait until it has finished.
|
||||||
echo "Waiting 2 seconds for bot shutdown"
|
kill -TERM "$pid" 2>/dev/null
|
||||||
sleep 2
|
wait "$pid"
|
||||||
|
exit $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user