This is an automated email from the ASF dual-hosted git repository.
mattisonchao pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new 698bf60780d [branch-2.9][fix][deploy]: fix the pid occupied check when
use pulsar-daemon start or stop process. (#15745)
698bf60780d is described below
commit 698bf60780d4fcfd628fb136f67312ed72a07396
Author: Qiang Zhao <[email protected]>
AuthorDate: Tue May 24 21:30:37 2022 +0800
[branch-2.9][fix][deploy]: fix the pid occupied check when use
pulsar-daemon start or stop process. (#15745)
---
bin/pulsar-daemon | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bin/pulsar-daemon b/bin/pulsar-daemon
index 8bbc62806be..3bd82acb946 100755
--- a/bin/pulsar-daemon
+++ b/bin/pulsar-daemon
@@ -143,7 +143,7 @@ mkdir -p "$PULSAR_LOG_DIR"
case $startStop in
(start)
if [ -f $pid ]; then
- if kill -0 `cat $pid` > /dev/null 2>&1; then
+ if ps -p `cat $pid` > /dev/null 2>&1; then
echo $command running as process `cat $pid`. Stop it first.
exit 1
fi
@@ -165,7 +165,7 @@ case $startStop in
(stop)
if [ -f $pid ]; then
TARGET_PID=$(cat $pid)
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ if ps -p $TARGET_PID > /dev/null 2>&1; then
echo "stopping $command"
kill $TARGET_PID
@@ -186,7 +186,7 @@ case $startStop in
echo "Shutdown completed."
fi
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ if ps -p $TARGET_PID > /dev/null 2>&1; then
fileName=$location/$command.out
$JAVA_HOME/bin/jstack $TARGET_PID > $fileName
echo "Thread dumps are taken for analysis at $fileName"