diff --git a/bin/bookkeeper-daemon.sh b/bin/bookkeeper-daemon.sh index 4e85a50ed64..d6b0dbec5eb 100755 --- a/bin/bookkeeper-daemon.sh +++ b/bin/bookkeeper-daemon.sh @@ -112,7 +112,7 @@ start() { if [ -f $pid_file ]; then PREVIOUS_PID=$(cat $pid_file) - if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then + if ps -p $PREVIOUS_PID > /dev/null 2>&1; then echo $command running as process $PREVIOUS_PID. Stop it first. exit 1 fi @@ -125,7 +125,7 @@ start() echo $! > $pid_file sleep 1; head $out sleep 2; - if ! kill -0 $! > /dev/null ; then + if ! ps -p $! > /dev/null ; then exit 1 fi } @@ -134,13 +134,13 @@ stop() { if [ -f $pid_file ]; then TARGET_PID=$(cat $pid_file) - 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 count=0 location=$BOOKIE_LOG_DIR - while kill -0 $TARGET_PID > /dev/null 2>&1; + while ps -p $TARGET_PID > /dev/null 2>&1; do echo "Shutdown is in progress... Please wait..." sleep 1 @@ -155,7 +155,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 # Check for the java to use if [[ -z ${JAVA_HOME} ]]; then