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

arshad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ambari-metrics.git


The following commit(s) were added to refs/heads/master by this push:
     new cc4204b  status: command not found (#125)
cc4204b is described below

commit cc4204bdb63b7a327bb82928ecbf598605188edf
Author: zzccctv <[email protected]>
AuthorDate: Thu Oct 3 00:05:51 2024 +0800

    status: command not found (#125)
    
    Co-authored-by: zhangzhanchang <[email protected]>
    Signed-off-by: Mohammad Arshad <[email protected]>
---
 .../conf/unix/ambari-metrics-grafana                  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana 
b/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
index 58c2598..9285799 100644
--- a/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
+++ b/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
@@ -89,7 +89,7 @@ fi
 DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} 
cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}"
 
 function isRunning() {
-  status -p $PID_FILE $NAME > /dev/null 2>&1
+  test -e "$PID_FILE"
 }
 
 case "$1" in
@@ -149,7 +149,7 @@ case "$1" in
     exit $return
     ;;
   stop)
-    echo -n "Stopping $DESC ..." >> $LOG_FILE
+    echo "Stopping $DESC ..." >> $LOG_FILE
 
     if [ -f "$PID_FILE" ]; then
       pid=$(cat "$PID_FILE")
@@ -169,13 +169,22 @@ case "$1" in
       fi
       echo "OK"
     else
-      echo -n "(not running)" >> $LOG_FILE
+      echo "(not running)" >> $LOG_FILE
     fi
     exit 0
     ;;
   status)
-    status -p $PID_FILE $NAME
-    exit $?
+    if [ -f "$PID_FILE" ]; then
+        pid=$(cat "$PID_FILE")
+        if ps -p "$pid" > /dev/null; then
+            echo "Already running."
+        else
+            echo "Not running."
+        fi
+    else
+        echo "Not running."
+    fi
+    exit 0
     ;;
   restart|force-reload)
     if [ -f "$PID_FILE" ]; then


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to