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/26 10:08:25 UTC
[39/45] incubator-kylin git commit: KYLIN-1061 "kylin.sh start"
should check whether kylin has already been running
KYLIN-1061 "kylin.sh start" should 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/4ab5612b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/4ab5612b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/4ab5612b
Branch: refs/heads/master
Commit: 4ab5612b0bb66b1640f5854a3ef825213d41a52c
Parents: 1696f70
Author: shaofengshi <sh...@apache.org>
Authored: Thu Oct 8 10:43:51 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Thu Oct 8 10:43:51 2015 +0800
----------------------------------------------------------------------
bin/kylin.sh | 40 ++++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4ab5612b/bin/kylin.sh
----------------------------------------------------------------------
diff --git a/bin/kylin.sh b/bin/kylin.sh
index 1334ed1..021e494 100644
--- a/bin/kylin.sh
+++ b/bin/kylin.sh
@@ -25,6 +25,16 @@ mkdir -p ${KYLIN_HOME}/logs
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
@@ -85,23 +95,25 @@ then
# stop command
elif [ $1 == "stop" ]
then
- if [ ! -f "${KYLIN_HOME}/pid" ]
- then
- echo "kylin is not running, please check"
- exit 1
- fi
- pid=`cat ${KYLIN_HOME}/pid`
- if [ "$pid" = "" ]
+ if [ -f "${KYLIN_HOME}/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
-
+
# tool command
elif [[ $1 = org.apache.kylin.* ]]
then