You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2016/12/01 08:13:56 UTC

[13/50] ambari git commit: AMBARI-18841 : Grafana fails to start (Commit 2) (avijayan)

AMBARI-18841 : Grafana fails to start (Commit 2) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1b63b909
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1b63b909
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1b63b909

Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 1b63b9094f28b04fa361d8ad3c7ab122716d544d
Parents: 98e41c6
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Mon Nov 28 10:06:32 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Mon Nov 28 10:06:32 2016 -0800

----------------------------------------------------------------------
 .../conf/unix/ambari-metrics-grafana            | 34 ++++++--------------
 1 file changed, 9 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1b63b909/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
index eeb189b..472942e 100644
--- a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
@@ -94,30 +94,14 @@ function isRunning() {
 
 case "$1" in
   start)
-    echo -n $"Starting $DESC: .... "
+    echo $"Starting $DESC: .... " >> $LOG_FILE
 
     isRunning
     if [ $? -eq 0 ]; then
-      echo "Already running."
+      echo "Already running." >> $LOG_FILE
       exit 0
     fi
 
-    echo "$(date) Checking for previously running Grafana with out of sync PID..." >> $LOG_FILE
-    if [ -n "`ps ax | grep -w ambari-metrics-grafana/bin/grafana-server`" ]; then
-      PID=`ps aux | grep -w ambari-metrics-grafana/bin/grafana-server | head -n 1 | awk '{print $2}'`
-      echo "$(date) Grafana Server already running with PID: ${PID}. Killing that instance"  >> $LOG_FILE
-      kill "${PID}" >/dev/null 2>&1
-      sleep "${STOP_TIMEOUT}"
-
-      if kill -0 "${PID}" > /dev/null 2>&1; then
-        echo "$(date) WARNING: Grafana Server did not stop gracefully. Trying to kill with kill -9" >> $LOG_FILE
-        kill -9 "${PID}" >/dev/null 2>&1
-      fi
-
-    else
-      echo "$(date) No out of sync Grafana server process found" >> $LOG_FILE
-    fi
-
     # Prepare environment
     # mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR"
     # touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
@@ -135,7 +119,7 @@ case "$1" in
       sleep 1
       # check if pid file has been written two
       if ! [[ -s $PID_FILE ]]; then
-        echo "FAILED"
+        echo "Start FAILED" >> $LOG_FILE
         exit 1
       fi
       i=0
@@ -152,11 +136,11 @@ case "$1" in
       done
     fi
 
-    echo "OK"
+    echo "OK" >> $LOG_FILE
     exit $return
     ;;
   stop)
-    echo -n "Stopping $DESC ..."
+    echo -n "Stopping $DESC ..." >> $LOG_FILE
 
     if [ -f "$PID_FILE" ]; then
       pid=$(cat "$PID_FILE")
@@ -165,18 +149,18 @@ case "$1" in
       sleep "${STOP_TIMEOUT}"
 
       if kill -0 "${pid}" > /dev/null 2>&1; then
-        echo "WARNING: $DESC did not stop gracefully after ${STOP_TIMEOUT} seconds: Trying to kill with kill -9"
+        echo "WARNING: $DESC did not stop gracefully after ${STOP_TIMEOUT} seconds: Trying to kill with kill -9" >> $LOG_FILE
         kill -9 "${pid}" >/dev/null 2>&1
       fi
 
       if ps -p "${pid}" > /dev/null 2>&1; then
-        echo "ERROR: Unable to kill ${pid}"
+        echo "ERROR: Unable to kill ${pid}" >> $LOG_FILE
       else
-        rm -f "${pidfile}" >/dev/null 2>&1
+        rm -f "$PID_FILE" >/dev/null 2>&1
       fi
       echo "OK"
     else
-      echo -n "(not running)"
+      echo -n "(not running)" >> $LOG_FILE
     fi
     exit 0
     ;;