HBASE-27275 graceful_stop.sh unable to restore the balance state (#4680)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
diff --git a/bin/graceful_stop.sh b/bin/graceful_stop.sh
index fc18239..da3495b 100755
--- a/bin/graceful_stop.sh
+++ b/bin/graceful_stop.sh
@@ -115,7 +115,7 @@
HBASE_BALANCER_STATE=false
else
log "Disabling load balancer"
- HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | tail -1)
+ HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}" shell -n | grep 'Previous balancer state' | awk -F": " '{print $2}')
log "Previous balancer state was $HBASE_BALANCER_STATE"
fi