You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2020/02/07 07:04:06 UTC
[kylin] 06/14: KYLIN-4290 Add file lock to kylin startup script to
avoid starting multiple instances on one node
This is an automated email from the ASF dual-hosted git repository.
nic pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 6d7cf0220a6dd24ea5661a973c475f6e552fbba9
Author: yangzheng10 <ya...@58.com>
AuthorDate: Tue Dec 10 19:10:51 2019 +0800
KYLIN-4290 Add file lock to kylin startup script to avoid starting multiple instances on one node
---
build/bin/kylin.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/build/bin/kylin.sh b/build/bin/kylin.sh
index d6a311e..00e545a 100755
--- a/build/bin/kylin.sh
+++ b/build/bin/kylin.sh
@@ -66,6 +66,14 @@ function retrieveStartCommand() {
fi
fi
+ lockfile=$KYLIN_HOME/LOCK
+ if [ ! -e $lockfile ]; then
+ trap "rm -f $lockfile; exit" INT TERM EXIT
+ touch $lockfile
+ else
+ quit "Kylin is starting, wait for it"
+ fi
+
source ${dir}/check-env.sh
tomcat_root=${dir}/../tomcat
@@ -130,6 +138,7 @@ if [ "$1" == "start" ]
then
retrieveStartCommand
${start_command} >> ${KYLIN_HOME}/logs/kylin.out 2>&1 & echo $! > ${KYLIN_HOME}/pid &
+ rm -f $lockfile
echo ""
echo "A new Kylin instance is started by $USER. To stop it, run 'kylin.sh stop'"
@@ -142,6 +151,7 @@ elif [ "$1" == "run" ]
then
retrieveStartCommand
${start_command}
+ rm -f $lockfile
# stop command
elif [ "$1" == "stop" ]