fix: bin/emqx change use ps -p to check if pid is running

This commit is contained in:
Zaiming Shi 2021-08-09 22:28:25 +02:00
parent cd92f73ca1
commit 1a80b9dc47
1 changed files with 5 additions and 2 deletions

View File

@ -302,9 +302,11 @@ bootstrapd() {
# check if a PID is down # check if a PID is down
is_down() { is_down() {
PID="$1" PID="$1"
if kill -s 0 "$PID" 2>/dev/null; then if ps -p "$PID" >/dev/null; then
# still alive
return 1 return 1
fi fi
# it's gone
return 0 return 0
} }
@ -484,7 +486,8 @@ case "$1" in
exit 1 exit 1
fi fi
WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}" WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}"
if ! wait_for "$WAIT_TIME" is_down "$PID"; then if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then
ps -p "$PID"
msg="dangling after ${WAIT_TIME} seconds" msg="dangling after ${WAIT_TIME} seconds"
# also log to syslog # also log to syslog
logger -t "${REL_NAME}[${PID}]" "STOP: $msg" logger -t "${REL_NAME}[${PID}]" "STOP: $msg"