HBASE-21281 Upgrade bouncycastle to latest
[hbase.git] / bin / hbase-common.sh
blob0a474f7304c6f8b26bd1536cf91b3d625970f092
1 ##
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
19 #Shared function to wait for a process end. Take the pid and the command name as parameters
20 waitForProcessEnd() {
21 pidKilled=$1
22 commandName=$2
23 processedAt=`date +%s`
24 while kill -0 $pidKilled > /dev/null 2>&1;
26 echo -n "."
27 sleep 1;
28 # if process persists more than $HBASE_STOP_TIMEOUT (default 1200 sec) no mercy
29 if [ $(( `date +%s` - $processedAt )) -gt ${HBASE_STOP_TIMEOUT:-1200} ]; then
30 break;
32 done
33 # process still there : kill -9
34 if kill -0 $pidKilled > /dev/null 2>&1; then
35 echo -n force stopping $commandName with kill -9 $pidKilled
36 $JAVA_HOME/bin/jstack -l $pidKilled > "$logout" 2>&1
37 kill -9 $pidKilled > /dev/null 2>&1
39 # Add a CR after we're done w/ dots.
40 echo