You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2015/10/08 10:47:42 UTC

incubator-kylin git commit: KYLIN-1061 check whether kylin has already been running

Repository: incubator-kylin
Updated Branches:
  refs/heads/2.x-staging 3dcfedfaa -> b5ea13ab7


KYLIN-1061 check whether kylin has already been running

Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/b5ea13ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/b5ea13ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/b5ea13ab

Branch: refs/heads/2.x-staging
Commit: b5ea13ab7e87302d53f2407083f3450903e03c24
Parents: 3dcfedf
Author: shaofengshi <sh...@apache.org>
Authored: Thu Oct 8 16:47:32 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Thu Oct 8 16:47:32 2015 +0800

----------------------------------------------------------------------
 build/bin/kylin.sh | 71 ++++++++++++++++++++++++++++---------------------
 1 file changed, 41 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b5ea13ab/build/bin/kylin.sh
----------------------------------------------------------------------
diff --git a/build/bin/kylin.sh b/build/bin/kylin.sh
index 03ee442..436a109 100644
--- a/build/bin/kylin.sh
+++ b/build/bin/kylin.sh
@@ -7,7 +7,16 @@ mkdir -p ${KYLIN_HOME}/logs
 # start command
 if [ $1 == "start" ]
 then
-
+    if [ -f "${KYLIN_HOME}/pid" ]
+    then
+        PID=`cat $KYLIN_HOME/pid`
+        if ps -p $PID > /dev/null
+        then
+          echo "Kylin is running, stop it first"
+          exit 1
+        fi
+    fi
+    
     tomcat_root=${dir}/../tomcat
     export tomcat_root
 
@@ -69,22 +78,24 @@ then
 # stop command
 elif [ $1 == "stop" ]
 then
-    if [ ! -f "${KYLIN_HOME}/pid" ]
+    if [ -f "${KYLIN_HOME}/pid" ]
     then
-        echo "kylin is not running, please check"
-        exit 1
-    fi
-    pid=`cat ${KYLIN_HOME}/pid`
-    if [ "$pid" = "" ]
-    then
-        echo "kylin is not running, please check"
-        exit 1
+        PID=`cat $KYLIN_HOME/pid`
+        if ps -p $PID > /dev/null
+        then
+           echo "stopping Kylin:$PID"
+           kill $PID
+           rm ${KYLIN_HOME}/pid
+           exit 0
+        else
+           echo "Kylin is not running, please check"
+           exit 1
+        fi
+        
     else
-        echo "stopping kylin:$pid"
-        kill $pid
+        echo "Kylin is not running, please check"
+        exit 1    
     fi
-    rm ${KYLIN_HOME}/pid
-    exit 0
 
 # streaming command
 elif [ $1 == "streaming" ]
@@ -126,24 +137,24 @@ then
     elif [ $2 == "stop" ]
     then
         if [ ! -f "${KYLIN_HOME}/$3_$4" ]
-        then
-            echo "streaming is not running, please check"
-            exit 1
-        fi
-        pid=`cat ${KYLIN_HOME}/$3_$4`
-        if [ "$pid" = "" ]
-        then
-            echo "streaming is not running, please check"
-            exit 1
+            then
+                echo "streaming is not running, please check"
+                exit 1
+            fi
+            pid=`cat ${KYLIN_HOME}/$3_$4`
+            if [ "$pid" = "" ]
+            then
+                echo "streaming is not running, please check"
+                exit 1
+            else
+                echo "stopping streaming:$pid"
+                kill $pid
+            fi
+            rm ${KYLIN_HOME}/$3_$4
+            exit 0
         else
-            echo "stopping streaming:$pid"
-            kill $pid
+            echo
         fi
-        rm ${KYLIN_HOME}/$3_$4
-        exit 0
-    else
-        echo
-    fi
 
 # monitor command
 elif [ $1 == "monitor" ]