guluo2016 commented on code in PR #7139:
URL: https://github.com/apache/hbase/pull/7139#discussion_r2188385980
##########
bin/hbase-common.sh:
##########
@@ -16,26 +16,48 @@
# limitations under the License.
##
-#Shared function to wait for a process end. Take the pid and the command name
as parameters
+# Shared function to wait for a process end. Take the pid and the command name
as parameters
waitForProcessEnd() {
- pidKilled=$1
- commandName=$2
- processedAt=`date +%s`
- while kill -0 $pidKilled > /dev/null 2>&1;
+ local pid_killed=$1
+ local command=$2
+ local proc_keyword="proc_$command"
+ local processed_at=`date +%s`
+ while is_process_alive $pid_killed $proc_keyword;
do
echo -n "."
sleep 1;
# if process persists more than $HBASE_STOP_TIMEOUT (default 1200 sec) no
mercy
- if [ $(( `date +%s` - $processedAt )) -gt ${HBASE_STOP_TIMEOUT:-1200} ];
then
+ if [ $(( `date +%s` - $processed_at )) -gt ${HBASE_STOP_TIMEOUT:-1200} ];
then
break;
fi
done
# process still there : kill -9
- if kill -0 $pidKilled > /dev/null 2>&1; then
- echo -n force stopping $commandName with kill -9 $pidKilled
- $JAVA_HOME/bin/jstack -l $pidKilled > "$logout" 2>&1
- kill -9 $pidKilled > /dev/null 2>&1
+ if is_process_alive $pid_killed $proc_keyword; then
+ echo -n force stopping $command with kill -9 $pid_killed
Review Comment:
Adding quotes seems better
`echo -n "force stopping $command with kill -9 $pid_killed"`
##########
bin/hbase-daemon.sh:
##########
@@ -110,17 +110,17 @@ cleanAfterRun() {
}
check_before_start(){
- #ckeck if the process is not running
+ # check if the process is not running
mkdir -p "$HBASE_PID_DIR"
if [ -f $HBASE_PID ]; then
- if kill -0 `cat $HBASE_PID` > /dev/null 2>&1; then
+ if is_process_alive `cat $HBASE_PID` "$HBASE_PROC_KEYWORD"; then
echo $command running as process `cat $HBASE_PID`. Stop it first.
Review Comment:
As above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]