ARTEMIS-4630 Validate if the pid is really from Artemis

In rare cases the status is returning 'running' to a process that is
not Artemis. It was create a extra level of verification by validating
if the running process working directory is the
same of ${ARTEMIS_INSTANCE}.
This commit is contained in:
Ângelo Galvão 2024-02-02 10:18:05 -05:00 committed by Justin Bertram
parent f91d7c51fd
commit 7ac6f4e99c
1 changed files with 5 additions and 1 deletions

View File

@ -59,9 +59,13 @@ fi
status() {
if [ -f "${PID_FILE}" ] ; then
pid=`cat "${PID_FILE}"`
pid_workdir=$ARTEMIS_INSTANCE
if [ `command -v lsof &> /dev/null` ]; then
pid_workdir="`lsof -a -d cwd -p ${pid} | awk '{print $9}' | tail -1`"
if
# check to see if it's gone...
ps -p ${pid} > /dev/null
if [ $? -eq 0 ] ; then
if [ $? -eq 0 ] && [ "$pid_workdir" = "$ARTEMIS_INSTANCE" ]; then
return 0
else
rm "${PID_FILE}"