This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new efa228ef446 HBASE-29307 Add status command to hbase-daemon.sh for 
process state checking (#6982)
efa228ef446 is described below

commit efa228ef446c0e63bbe2915a48d3324efab79ccc
Author: JinHyuk Kim <[email protected]>
AuthorDate: Sat May 17 11:38:23 2025 +0900

    HBASE-29307 Add status command to hbase-daemon.sh for process state 
checking (#6982)
    
    Signed-off-by: Duo Zhang <[email protected]>
    Reviewed-by: Dávid Paksy <[email protected]>
    Reviewed-by: Junegunn Choi <[email protected]>
    (cherry picked from commit deac89e9487821b5b1c237b8395cee10ac745bd6)
---
 bin/hbase-daemon.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/bin/hbase-daemon.sh b/bin/hbase-daemon.sh
index b3514bfd42a..4ab456b6a22 100755
--- a/bin/hbase-daemon.sh
+++ b/bin/hbase-daemon.sh
@@ -35,7 +35,7 @@
 usage="Usage: hbase-daemon.sh [--config <conf-dir>]\
  [--autostart-window-size <window size in hours>]\
  [--autostart-window-retry-limit <retry count limit for autostart>]\
- (start|stop|restart|autostart|autorestart|foreground_start) <hbase-command> \
+ (start|stop|restart|autostart|autorestart|foreground_start|status) 
<hbase-command> \
  <args...>"
 
 # if no args specified, show usage
@@ -376,6 +376,19 @@ case $startStop in
     wait_until_done $!
   ;;
 
+(status)
+    if [ -f $HBASE_PID ]; then
+      pid=`cat $HBASE_PID`
+      if kill -0 "$pid" > /dev/null 2>&1; then
+        echo "$command is running as PID $pid"
+        exit 0
+      fi
+    fi
+
+    echo "$command is not running"
+    exit 1
+  ;;
+
 (*)
   echo $usage
   exit 1

Reply via email to