HADOOP-14855. Hadoop scripts may errantly believe a daemon is still running, preventing it from starting. Contributed by Robert Kanter.

This commit is contained in:
Miklos Szegedi 2018-04-04 15:35:58 -07:00
parent 345e7624d5
commit e52539b46f

View File

@ -1725,12 +1725,17 @@ function hadoop_status_daemon
shift
local pid
local pspid
if [[ -f "${pidfile}" ]]; then
pid=$(cat "${pidfile}")
if ps -p "${pid}" > /dev/null 2>&1; then
if pspid=$(ps -o args= -p"${pid}" 2>/dev/null); then
# this is to check that the running process we found is actually the same
# daemon that we're interested in
if [[ ${pspid} =~ -Dproc_${daemonname} ]]; then
return 0
fi
fi
return 1
fi
return 3