Skip to content

Commit

Permalink
[HotFix] hotfix auto.sh (DataLinkDC#3289)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 authored Mar 14, 2024
1 parent 09e6257 commit 056604c
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions script/bin/auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

FLINK_VERSION=${2}

if [ -z "${FLINK_VERSION}" ]; then
echo "please specify the flink version, for example: sh auto.sh start 1.16"
exit 1
fi

APP_HOME="$(cd `dirname $0`; pwd)"

Expand All @@ -14,6 +10,23 @@ EXTENDS_HOME="${APP_HOME}/extends"
JAR_NAME="dinky-admin"


if [ -z "${FLINK_VERSION}" ]; then
# Obtain the Flink version under EXTENDSHOME, only perform recognition and do not perform any other operations, for prompt purposes
FLINK_VERSION_SCAN=$(ls ${EXTENDS_HOME} | grep flink | awk -F 'flink' '{print $2}')
# If FLINK_VERSION-SCAN is not empty, assign FLINK_VERSION-SCAN to FLINK_VERSION
if [ -n "${FLINK_VERSION_SCAN}" ]; then
FLINK_VERSION=${FLINK_VERSION_SCAN}
fi
fi

# Check whether the flink version is specified
assertIsInputVersion() {
# If FLINK_VERSION is still empty, prompt the user to enter the Flink version
if [ -z "${FLINK_VERSION}" ]; then
echo "The flink version is not specified and the flink version cannot be found under the extends directory. Please specify the flink version."
exit 1
fi
}

# Use FLINK_HOME:
CLASS_PATH="${APP_HOME}:${APP_HOME}/lib/*:${APP_HOME}/config:${EXTENDS_HOME}/*:${EXTENDS_HOME}/flink${FLINK_VERSION}/dinky/*:${EXTENDS_HOME}/flink${FLINK_VERSION}/*"
Expand Down Expand Up @@ -51,6 +64,7 @@ updatePid() {
}

start() {
assertIsInputVersion
updatePid
if [ -z "$pid" ]; then
nohup java -Ddruid.mysql.usePingMethod=false -Dlog4j2.isThreadContextMapInheritable=true -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -cp "${CLASS_PATH}" org.dinky.Dinky > /dev/null 2>&1 &
Expand All @@ -63,6 +77,7 @@ start() {
}

startOnPending() {
assertIsInputVersion
updatePid
if [ -z "$pid" ]; then
java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -cp "${CLASS_PATH}" org.dinky.Dinky
Expand All @@ -73,6 +88,7 @@ startOnPending() {
}

startWithJmx() {
assertIsInputVersion
updatePid
if [ -z "$pid" ]; then
nohup java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none "${JMX}" -cp "${CLASS_PATH}" org.dinky.Dinky > /dev/null 2>&1 &
Expand Down Expand Up @@ -114,13 +130,15 @@ status() {

restart() {
echo ""
assertIsInputVersion
stop
start
echo "........................................Restart Successfully........................................"
}

restartWithJmx() {
echo ""
assertIsInputVersion
stop
startWithJmx
echo "........................................Restart with Jmx Successfully........................................"
Expand Down

0 comments on commit 056604c

Please sign in to comment.