[fix][deploy]: fix the pid occupied check when use pulsar-daemon start or stop process
@@ -141,7 +141,7 @@ rotate_out_log ()
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
@@ -164,7 +164,7 @@ 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
@@ -185,7 +185,7 @@ stop ()
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"
