HBASE-19784 bin/stop-hbase more friendly when hbase already stopped Signed-off-by: Michael Stack <st...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b1729a29 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b1729a29 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b1729a29 Branch: refs/heads/HBASE-19064 Commit: b1729a298bbcfeb54ba95821096408612e8ccef5 Parents: eeb40ff Author: Mike Drob <md...@apache.org> Authored: Fri Jan 12 08:34:49 2018 -0600 Committer: Michael Stack <st...@apache.org> Committed: Wed Jan 17 15:48:53 2018 -0800 ---------------------------------------------------------------------- bin/stop-hbase.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b1729a29/bin/stop-hbase.sh ---------------------------------------------------------------------- diff --git a/bin/stop-hbase.sh b/bin/stop-hbase.sh index 8b81dee..4a19681 100755 --- a/bin/stop-hbase.sh +++ b/bin/stop-hbase.sh @@ -44,17 +44,20 @@ logout=$HBASE_LOG_DIR/$HBASE_LOG_PREFIX.out loglog="${HBASE_LOG_DIR}/${HBASE_LOGFILE}" pid=${HBASE_PID_DIR:-/tmp}/hbase-$HBASE_IDENT_STRING-master.pid -echo -n stopping hbase -echo "`date` Stopping hbase (via master)" >> $loglog +if [[ -e $pid ]]; then + echo -n stopping hbase + echo "`date` Stopping hbase (via master)" >> $loglog -nohup nice -n ${HBASE_NICENESS:-0} "$HBASE_HOME"/bin/hbase \ - --config "${HBASE_CONF_DIR}" \ - master stop "$@" > "$logout" 2>&1 < /dev/null & + nohup nice -n ${HBASE_NICENESS:-0} "$HBASE_HOME"/bin/hbase \ + --config "${HBASE_CONF_DIR}" \ + master stop "$@" > "$logout" 2>&1 < /dev/null & -waitForProcessEnd `cat $pid` 'stop-master-command' - -rm -f $pid + waitForProcessEnd `cat $pid` 'stop-master-command' + rm -f $pid +else + echo no hbase master found +fi # distributed == false means that the HMaster will kill ZK when it exits # HBASE-6504 - only take the first line of the output in case verbose gc is on