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 }