You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2023/03/20 03:46:52 UTC
[inlong] 02/03: [INLONG-7511][Manager] Update the manager's stop script to make sure the process stops completely. (#7645)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/inlong.git
commit 2856dc95d16db3589654bf672bdfa3e7c9a6ed62
Author: castorqin <58...@users.noreply.github.com>
AuthorDate: Mon Mar 20 11:16:32 2023 +0800
[INLONG-7511][Manager] Update the manager's stop script to make sure the process stops completely. (#7645)
Co-authored-by: castorqin <ca...@tencent.com>
---
inlong-manager/manager-web/bin/shutdown.sh | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/inlong-manager/manager-web/bin/shutdown.sh b/inlong-manager/manager-web/bin/shutdown.sh
index 751ca286a..6c52ee035 100755
--- a/inlong-manager/manager-web/bin/shutdown.sh
+++ b/inlong-manager/manager-web/bin/shutdown.sh
@@ -30,12 +30,27 @@ echo stop ${APPLICATION} Application...
# Project startup jar package name
APPLICATION_JAR="manager-web.jar"
+INLONG_STOP_TIMEOUT=30
PID=$(ps -ef | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }')
if [[ -z "$PID" ]]; then
echo ${APPLICATION} was already stopped
+fi
+echo "${APPLICATION} stopping"
+kill -15 ${PID}
+count=0
+while ps -p ${PID} > /dev/null;
+do
+ echo "Shutdown is in progress... Please wait..."
+ sleep 1
+ count=$((count+1))
+ if [ ${count} -eq ${INLONG_STOP_TIMEOUT} ]; then
+ break
+ fi
+done
+if ps -p ${PID} > /dev/null; then
+ echo "${APPLICATION} did not stop gracefully, killing with SIGKILL..."
+ kill -9 ${PID}
else
- echo ${APPLICATION} running with PID ${PID}, begin to stop...
- kill -9 ${PID}
- echo ${APPLICATION} stopped successfully
+ echo "${APPLICATION} stopped successfully"
fi