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
23 processedAt
=`date +%s`
24 while kill -0 $pidKilled > /dev
/null
2>&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
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.