From ac35409e88171e4f9a9c16f8c893711d3733193f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=B4=E7=AB=A0?= Date: Sat, 18 Jun 2022 21:30:49 +0800 Subject: [PATCH] add start shell --- rsqldb-disk/bin/start-sql.sh | 49 ------------------- rsqldb-disk/bin/{start.sh => startRunner.sh} | 4 +- rsqldb-disk/bin/startServer.sh | 30 ++++++++++++ rsqldb-server/pom.xml | 1 + .../alibaba/rsqldb/server/Application.java | 2 +- 5 files changed, 35 insertions(+), 51 deletions(-) delete mode 100644 rsqldb-disk/bin/start-sql.sh rename rsqldb-disk/bin/{start.sh => startRunner.sh} (91%) create mode 100644 rsqldb-disk/bin/startServer.sh diff --git a/rsqldb-disk/bin/start-sql.sh b/rsqldb-disk/bin/start-sql.sh deleted file mode 100644 index 4c28bb2..0000000 --- a/rsqldb-disk/bin/start-sql.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -set -e - -PROG_NAME=$0 -JOB_FILE_PATH=$1 -JOB_NAMESPACE=$2 -JOB_NAMES=$3 -JVM_CONFIG=$4 - - -if [ -z "${JVM_CONFIG}" ]; then - JVM_CONFIG="-Xms2048m -Xmx2048m -Xmn1024m" -fi -ROCKETMQ_STREAMS_HOME=$(cd $(dirname ${BASH_SOURCE[0]})/..; pwd) -ROCKETMQ_STREAMS_CONFIGURATION=$ROCKETMQ_STREAMS_HOME/conf -ROCKETMQ_STREAMS_EXT=$ROCKETMQ_STREAMS_HOME/ext -ROCKETMQ_STREAMS_DEPENDENCIES=$ROCKETMQ_STREAMS_HOME/lib -ROCKETMQ_STREAMS_LOGS=$ROCKETMQ_STREAMS_HOME/log/catalina.out - -if [ -z "${JAVA_HOME:-}" ]; then - JAVA="java -server" -else - JAVA="$JAVA_HOME/bin/java -server" -fi - -JAVA_OPTIONS=${JAVA_OPTIONS:-} - -JVM_OPTS=() -if [ ! -z "${JAVA_OPTIONS}" ]; then - JVM_OPTS+=("${JAVA_OPTIONS}") -fi -if [ ! -z "${JVM_CONFIG}" ]; then - JVM_OPTS+=("${JVM_CONFIG}") -fi - -JVM_OPTS+=( "-Dlog4j.configuration=$ROCKETMQ_STREAMS_CONFIGURATION/log4j.xml" ) - -# shellcheck disable=SC2068 -# shellcheck disable=SC2039 - -if [ ! -z "${JOB_NAMES}" -a ! -z "${JOB_NAMESPACE}" ]; then - eval exec $JAVA ${JVM_OPTS[@]} -classpath "$ROCKETMQ_STREAMS_DEPENDENCIES/*:$ROCKETMQ_STREAMS_EXT/*:$ROCKETMQ_STREAMS_CONFIGURATION/*" org.apache.rsqldb.runner.SqlAction $JOB_FILE_PATH $JOB_NAMESPACE $JOB_NAMES "&" >>"$ROCKETMQ_STREAMS_LOGS" 2>&1 -elif [ ! -z "${JOB_NAMESPACE}" ]; then - eval exec $JAVA ${JVM_OPTS[@]} -classpath "$ROCKETMQ_STREAMS_DEPENDENCIES/*:$ROCKETMQ_STREAMS_EXT/*:$ROCKETMQ_STREAMS_CONFIGURATION/*" org.apache.rsqldb.runner.SqlAction $JOB_FILE_PATH $JOB_NAMESPACE "&" >>"$ROCKETMQ_STREAMS_LOGS" 2>&1 -else - eval exec $JAVA ${JVM_OPTS[@]} -classpath "$ROCKETMQ_STREAMS_DEPENDENCIES/*:$ROCKETMQ_STREAMS_EXT/*:$ROCKETMQ_STREAMS_CONFIGURATION/*" org.apache.rsqldb.runner.SqlAction $JOB_FILE_PATH "&" >>"$ROCKETMQ_STREAMS_LOGS" 2>&1 -fi - - diff --git a/rsqldb-disk/bin/start.sh b/rsqldb-disk/bin/startRunner.sh similarity index 91% rename from rsqldb-disk/bin/start.sh rename to rsqldb-disk/bin/startRunner.sh index 627d754..d1e7a8b 100644 --- a/rsqldb-disk/bin/start.sh +++ b/rsqldb-disk/bin/startRunner.sh @@ -22,9 +22,11 @@ if [ ! -z "${JVM_CONFIG}" ]; then JVM_OPTS+=("${JVM_CONFIG}") fi +JVM_OPTS+=( "-Dlog4j.configuration=${BASE_DIR}/conf/log4j.xml" ) + JVM_OPTS="${JVM_OPTS} -cp ${CLASSPATH}" -#JVM_OPTS+=( "-Dlog4j.configuration=$ROCKETMQ_STREAMS_CONFIGURATION/log4j.xml" ) + # shellcheck disable=SC2068 # shellcheck disable=SC2039 diff --git a/rsqldb-disk/bin/startServer.sh b/rsqldb-disk/bin/startServer.sh new file mode 100644 index 0000000..026891e --- /dev/null +++ b/rsqldb-disk/bin/startServer.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -e + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${BASE_DIR}/lib/*:${CLASSPATH} + +JVM_CONFIG="-Xms2048m -Xmx2048m -Xmn1024m" + +JAVA_OPTIONS=${JAVA_OPTIONS:-} + +JVM_OPTS=() +if [ ! -z "${JAVA_OPTIONS}" ]; then + JVM_OPTS+=("${JAVA_OPTIONS}") +fi +if [ ! -z "${JVM_CONFIG}" ]; then + JVM_OPTS+=("${JVM_CONFIG}") +fi + +JVM_OPTS="${JVM_OPTS} -cp ${CLASSPATH}" + + +$JAVA ${JVM_OPTS} -jar ${BASE_DIR}/lib/rsqldb-server-1.0.0-SNAPSHOT.jar + + diff --git a/rsqldb-server/pom.xml b/rsqldb-server/pom.xml index 71aaa41..333b726 100644 --- a/rsqldb-server/pom.xml +++ b/rsqldb-server/pom.xml @@ -56,6 +56,7 @@ org.springframework.boot spring-boot-maven-plugin + 1.5.7.RELEASE diff --git a/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java b/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java index e3b54b2..73fd454 100644 --- a/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java +++ b/rsqldb-server/src/main/java/com/alibaba/rsqldb/server/Application.java @@ -4,7 +4,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -@SpringBootApplication(scanBasePackages = {"com.alibaba.rsqldb.clients"}, exclude = DataSourceAutoConfiguration.class) +@SpringBootApplication(scanBasePackages = {"com.alibaba.rsqldb.server"}, exclude = DataSourceAutoConfiguration.class) public class Application { public static void main(String[] args) {