kyuubi/bin/start-kyuubi.sh
Guillem Nieto a131ce0535 Squashed commit of the following:
commit 065238d830e1bf237cf5b5d74f987827cbe3ba61
Author: Guillem Nieto <gnieto@scopely.com>
Date:   Thu May 9 17:01:37 2019 +0200

    Cast to int wc jar count

    While using Kyuubi on my local environment (OSX) I'm having issues with
    `wc` returning the result with a preffixed tab character.

    Due to this issue, it fails to compare "	1" with "1" and script
    is aborted due to duplicated JARs found.

    To solve that, I'm casting `wc` result to integer and perform integer
    comparisions, which seems to solve the issue.
2019-05-10 12:01:35 +08:00

72 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
## Kyuubi Server Main Entrance
CLASS="yaooqinn.kyuubi.server.KyuubiServer"
BIN_DIR="$(cd "`dirname "$0"`"; pwd)"
echo "Welcome to"
cat $BIN_DIR/kyuubi-logo
set -a
. "${BIN_DIR}/kyuubi-env.sh"
set +a
function usage {
echo "Usage: ./bin/start-kyuubi.sh <args...>"
}
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
usage
exit 0
fi
## Find the Kyuubi Jar
if [[ -z "$KYUUBI_JAR_DIR" ]]; then
KYUUBI_JAR_DIR="$KYUUBI_HOME/lib"
if [[ ! -d ${KYUUBI_JAR_DIR} ]]; then
echo -e "\nCandidate Kyuubi lib $KYUUBI_JAR_DIR doesn't exist, searching development environment..."
KYUUBI_JAR_DIR="$KYUUBI_HOME/kyuubi-server/target"
fi
fi
KYUUBI_JAR_NUM="$(ls ${KYUUBI_JAR_DIR} | grep kyuubi-server | grep .jar | grep -v original | wc -l)"
KYUUBI_JAR_NUM=$((${KYUUBI_JAR_NUM}))
if [[ ${KYUUBI_JAR_NUM} = 0 ]]; then
echo "Kyuubi Server: need to build kyuubi first. Run ./build/mvn clean package" >&2
exit 1
fi
if [[ ${KYUUBI_JAR_NUM} != 1 ]]; then
echo "Kyuubi Server: duplicated kyuubi jars found. Run ./build/mvn clean package" >&2
exit 1
fi
export KYUUBI_JAR=${KYUUBI_JAR_DIR}/"$(ls ${KYUUBI_JAR_DIR} | grep kyuubi-server | grep -v original | grep .jar)"
echo "Kyuubi Server: jar founded:" ${KYUUBI_JAR} >&2
if [[ "$KYUUBI_SUBMIT_ENABLE" == "true" ]]; then
exec "${KYUUBI_HOME}"/bin/kyuubi-daemon.sh start ${CLASS} 1 "$@" "$KYUUBI_JAR"
else
exec "${SPARK_HOME}"/sbin/spark-daemon.sh submit ${CLASS} 1 "$@" "$KYUUBI_JAR"
fi