kyuubi/bin/kyuubi-ctl
fwang12 091a9bec8f [KYUUBI #304] Add kyuubi-ctl shell script
![turboFei](https://badgen.net/badge/Hello/turboFei/green) [![Closes #512](https://badgen.net/badge/Preview/Closes%20%23512/blue)](https://github.com/yaooqinn/kyuubi/pull/512) ![46](https://badgen.net/badge/%2B/46/red) ![0](https://badgen.net/badge/-/0/green) ![1](https://badgen.net/badge/commits/1/yellow) [<img width="16" alt="Powered by Pull Request Badge" src="https://user-images.githubusercontent.com/1393946/111216524-d2bb8e00-85d4-11eb-821b-ed4c00989c02.png">](https://pullrequestbadge.com/?utm_medium=github&utm_source=yaooqinn&utm_campaign=badge_info)<!-- PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT -->

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/yaooqinn/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
Add shell script `kyuubi-ctl` to launch kyuubi service control client.

### _How was this patch tested?_
Run test locally.
![image](https://user-images.githubusercontent.com/6757692/114349132-14bafe00-9b9a-11eb-8e29-53eaa5be4c03.png)

- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request

Closes #512 from turboFei/kyuubi_ctl_shell.

Closes #304

b2a24c0 [fwang12] Add kyuubi-ctl shell script

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: Cheng Pan <379377944@qq.com>
2021-04-12 15:50:09 +08:00

47 lines
1.6 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 Service Control Client Entrance
CLASS="org.apache.kyuubi.ctl.ServiceControlCli"
export KYUUBI_HOME="$(cd "$(dirname "$0")"/..; pwd)"
echo "Starting Kyuubi Service Control Client from ${KYUUBI_HOME}"
. "${KYUUBI_HOME}/bin/load-kyuubi-env.sh"
if [[ -z ${JAVA_HOME} ]]; then
echo "Error: JAVA_HOME IS NOT SET! CANNOT PROCEED."
exit 1
fi
RUNNER="${JAVA_HOME}/bin/java"
## Find the Kyuubi Jar
if [[ -z "$KYUUBI_JAR_DIR" ]]; then
KYUUBI_JAR_DIR="$KYUUBI_HOME/jars"
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-assembly/target/scala-${KYUUBI_SCALA_VERSION}/jars"
fi
fi
KYUUBI_CLASSPATH="${KYUUBI_JAR_DIR}/*:${KYUUBI_CONF_DIR}:${HADOOP_CONF_DIR}"
exec ${RUNNER} ${KYUUBI_JAVA_OPTS} -cp ${KYUUBI_CLASSPATH} $CLASS "$@"