fix: ps -ef to detect defunct pid

This commit is contained in:
Ivan Dyachkov 2023-07-18 11:51:39 +02:00
parent 2594998fd0
commit 42627a3d42
1 changed files with 2 additions and 2 deletions

View File

@ -811,8 +811,8 @@ is_down() {
PID="$1" PID="$1"
if ps -p "$PID" >/dev/null; then if ps -p "$PID" >/dev/null; then
# still around # still around
# shellcheck disable=SC2009 # this grep pattern is not a part of the progra names # shellcheck disable=SC2009 # this grep pattern is not a part of the program names
if ps -p "$PID" | $GREP -q 'defunct'; then if ps -efp "$PID" | $GREP -q 'defunct'; then
# zombie state, print parent pid # zombie state, print parent pid
parent="$(ps -o ppid= -p "$PID" | tr -d ' ')" parent="$(ps -o ppid= -p "$PID" | tr -d ' ')"
logwarn "$PID is marked <defunct>, parent: $(ps -p "$parent")" logwarn "$PID is marked <defunct>, parent: $(ps -p "$parent")"