From 85b4a4ef0c5fe346f3a57455a07871c662f83a85 Mon Sep 17 00:00:00 2001 From: tomsun28 Date: Sat, 21 Sep 2024 11:37:13 +0800 Subject: [PATCH] [improve] revert modify bin shells (#2735) --- script/assembly/collector/assembly-linux-amd64.xml | 2 +- script/assembly/collector/assembly-linux-arm64.xml | 2 +- script/assembly/collector/assembly-macos-amd64.xml | 2 +- script/assembly/collector/assembly-macos-arm64.xml | 2 +- script/assembly/collector/assembly-windows-64.xml | 2 +- script/assembly/collector/assembly.xml | 2 +- script/assembly/collector/bin/entrypoint.sh | 8 +++----- script/assembly/collector/bin/restart.sh | 13 ++----------- script/assembly/collector/bin/shutdown.bat | 6 +++--- script/assembly/collector/bin/shutdown.sh | 4 ++-- script/assembly/collector/bin/startup.bat | 8 +++----- script/assembly/collector/bin/startup.sh | 8 +++----- script/assembly/server/assembly-linux-amd64.xml | 2 +- script/assembly/server/assembly-linux-arm64.xml | 2 +- script/assembly/server/assembly-macos-amd64.xml | 2 +- script/assembly/server/assembly-macos-arm64.xml | 2 +- script/assembly/server/assembly-windows-64.xml | 2 +- script/assembly/server/assembly.xml | 2 +- script/assembly/server/bin/entrypoint.sh | 8 +++----- script/assembly/server/bin/restart.sh | 13 ++----------- script/assembly/server/bin/shutdown.bat | 6 +++--- script/assembly/server/bin/shutdown.sh | 4 ++-- script/assembly/server/bin/startup.bat | 8 +++----- script/assembly/server/bin/startup.sh | 8 +++----- 24 files changed, 44 insertions(+), 74 deletions(-) diff --git a/script/assembly/collector/assembly-linux-amd64.xml b/script/assembly/collector/assembly-linux-amd64.xml index f90c97b57f8..9d230f12d99 100644 --- a/script/assembly/collector/assembly-linux-amd64.xml +++ b/script/assembly/collector/assembly-linux-amd64.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/assembly-linux-arm64.xml b/script/assembly/collector/assembly-linux-arm64.xml index b93341f2397..900f827b2a4 100644 --- a/script/assembly/collector/assembly-linux-arm64.xml +++ b/script/assembly/collector/assembly-linux-arm64.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/assembly-macos-amd64.xml b/script/assembly/collector/assembly-macos-amd64.xml index 8564c632b7b..416a34c7408 100644 --- a/script/assembly/collector/assembly-macos-amd64.xml +++ b/script/assembly/collector/assembly-macos-amd64.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/assembly-macos-arm64.xml b/script/assembly/collector/assembly-macos-arm64.xml index de9f14f8661..4394639afbd 100644 --- a/script/assembly/collector/assembly-macos-arm64.xml +++ b/script/assembly/collector/assembly-macos-arm64.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/assembly-windows-64.xml b/script/assembly/collector/assembly-windows-64.xml index f457cd411dc..fe7f1412545 100644 --- a/script/assembly/collector/assembly-windows-64.xml +++ b/script/assembly/collector/assembly-windows-64.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/assembly.xml b/script/assembly/collector/assembly.xml index 5cae898315d..1d2beb0a973 100644 --- a/script/assembly/collector/assembly.xml +++ b/script/assembly/collector/assembly.xml @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/collector/bin/entrypoint.sh b/script/assembly/collector/bin/entrypoint.sh index c6a86adb8ce..0867dc8c489 100644 --- a/script/assembly/collector/bin/entrypoint.sh +++ b/script/assembly/collector/bin/entrypoint.sh @@ -17,10 +17,10 @@ # limitations under the License. # project name -SERVER_NAME="hertzbeat-collector" +SERVER_NAME="${project.build.finalName}" # jar name -#JAR_NAME="${project.build.finalName}.jar" +JAR_NAME="${project.build.finalName}.jar" # cd bin cd `dirname $0` @@ -34,10 +34,8 @@ DEPLOY_DIR=`pwd` # config dir CONF_DIR=$DEPLOY_DIR/config MAIN_CLASS="org.apache.hertzbeat.collector.Collector" -LIB_PATH="$DEPLOY_DIR/lib" EXT_LIB_PATH="$DEPLOY_DIR/ext-lib" -TARGET_LIB_PATH="$DEPLOY_DIR/target" -CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*" +CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*" # log dir LOGS_DIR=$DEPLOY_DIR/logs # create logs dir when not exist diff --git a/script/assembly/collector/bin/restart.sh b/script/assembly/collector/bin/restart.sh index 3ef7f991cfd..30bd4f6e526 100644 --- a/script/assembly/collector/bin/restart.sh +++ b/script/assembly/collector/bin/restart.sh @@ -16,23 +16,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# cd bin dir -cd `dirname $0` -# bin dir -BIN_DIR=`pwd` -# return root dir -cd .. -# root path dir -DEPLOY_DIR=`pwd` - # restart start time startTime=$(date +%s) echo -e "\033[0;31mCurrent Time is:$(date "+%Y-%m-%d %H:%M:%S") Restart Now!\033[0m" -$DEPLOY_DIR/bin/shutdown.sh +./shutdown.sh echo sleep 2 echo -$DEPLOY_DIR/bin/startup.sh +./startup.sh # restart end time endTime=$(date +%s) echo -e "\033[0;31mCurrent Time is:$(date "+%Y-%m-%d %H:%M:%S") Restart Success!Spend $((endTime - startTime)) seconds \033[0m"; diff --git a/script/assembly/collector/bin/shutdown.bat b/script/assembly/collector/bin/shutdown.bat index 9acadc0d31b..41a4599ec50 100644 --- a/script/assembly/collector/bin/shutdown.bat +++ b/script/assembly/collector/bin/shutdown.bat @@ -19,17 +19,17 @@ @echo off setlocal enabledelayedexpansion -set SERVER_NAME="hertzbeat-collector" +set SERVER_NAME="${project.artifactId}" set SERVER_PORT=1159 -echo Start shutdown HertzBeat %SERVER_NAME% +echo Start shutdown HertzBeat %SERVER_NAME% for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%SERVER_PORT%"') do ( echo kill the process %%m who use the port taskkill /pid %%m -t -f - echo Shutdown HertzBeat %SERVER_NAME% Success! + echo Shutdown HertzBeat %SERVER_NAME% Success! goto q ) echo Failed shutdown HertzBeat %SERVER_NAME% diff --git a/script/assembly/collector/bin/shutdown.sh b/script/assembly/collector/bin/shutdown.sh index bce36f4a2d4..e394ea1541d 100644 --- a/script/assembly/collector/bin/shutdown.sh +++ b/script/assembly/collector/bin/shutdown.sh @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # project name -APPLICATION="hertzbeat-collector" +APPLICATION="${project.artifactId}" # jar file name -APPLICATION_JAR="hertzbeat.collector" +APPLICATION_JAR="${project.build.finalName}.jar" # find the service pid, kill -9 pid PID=$(ps -ef | grep java | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }') diff --git a/script/assembly/collector/bin/startup.bat b/script/assembly/collector/bin/startup.bat index d644e498f79..03eeca15333 100644 --- a/script/assembly/collector/bin/startup.bat +++ b/script/assembly/collector/bin/startup.bat @@ -19,9 +19,9 @@ @echo off setlocal enabledelayedexpansion -set SERVER_NAME="hertzbeat-collector" +set SERVER_NAME=${project.artifactId} -@REM set JAR_NAME=${project.build.finalName}.jar +set JAR_NAME=${project.build.finalName}.jar rem enter the bin directory cd /d %~dp0 @@ -43,10 +43,8 @@ for /f "tokens=1-5" %%i in ('netstat -ano^|findstr "0.0.0.0:%SERVER_PORT%"') do ) set MAIN_CLASS=org.apache.hertzbeat.collector.Collector set LOGS_DIR=%DEPLOY_DIR%\logs -set LIB_PATH=%DEPLOY_DIR%\lib set EXT_LIB_PATH=%DEPLOY_DIR%\ext-lib -set TARGET_LIB_PATH=%DEPLOY_DIR%\target -set CLASSPATH=%LIB_PATH%\*;%TARGET_LIB_PATH%\*;%EXT_LIB_PATH%\* +set CLASSPATH=%DEPLOY_DIR%\%JAR_NAME%;%EXT_LIB_PATH%\* if not exist %LOGS_DIR% ( mkdir %LOGS_DIR% diff --git a/script/assembly/collector/bin/startup.sh b/script/assembly/collector/bin/startup.sh index ba29f20a444..5b48adce441 100644 --- a/script/assembly/collector/bin/startup.sh +++ b/script/assembly/collector/bin/startup.sh @@ -17,10 +17,10 @@ # limitations under the License. # project name -SERVER_NAME="hertzbeat-collector" +SERVER_NAME="${project.artifactId}" # jar file name -#JAR_NAME="${project.build.finalName}.jar" +JAR_NAME="${project.build.finalName}.jar" # cd bin dir cd `dirname $0` @@ -72,10 +72,8 @@ if [ -n "$SERVER_PORT" ]; then fi fi MAIN_CLASS="org.apache.hertzbeat.collector.Collector" -LIB_PATH="$DEPLOY_DIR/lib" EXT_LIB_PATH="$DEPLOY_DIR/ext-lib" -TARGET_LIB_PATH="$DEPLOY_DIR/target" -CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*" +CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*" # log dir LOGS_DIR=$DEPLOY_DIR/logs # create logs dir when not exist diff --git a/script/assembly/server/assembly-linux-amd64.xml b/script/assembly/server/assembly-linux-amd64.xml index b18e5a7020c..05e519218c3 100644 --- a/script/assembly/server/assembly-linux-amd64.xml +++ b/script/assembly/server/assembly-linux-amd64.xml @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/assembly-linux-arm64.xml b/script/assembly/server/assembly-linux-arm64.xml index 97895080be9..4e2158803d8 100644 --- a/script/assembly/server/assembly-linux-arm64.xml +++ b/script/assembly/server/assembly-linux-arm64.xml @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/assembly-macos-amd64.xml b/script/assembly/server/assembly-macos-amd64.xml index 38a4e666dff..3c68541b447 100644 --- a/script/assembly/server/assembly-macos-amd64.xml +++ b/script/assembly/server/assembly-macos-amd64.xml @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/assembly-macos-arm64.xml b/script/assembly/server/assembly-macos-arm64.xml index 4f6af2bfd8d..c230d513b3f 100644 --- a/script/assembly/server/assembly-macos-arm64.xml +++ b/script/assembly/server/assembly-macos-arm64.xml @@ -71,7 +71,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/assembly-windows-64.xml b/script/assembly/server/assembly-windows-64.xml index 1ba8940cc0a..b2ba21b230f 100644 --- a/script/assembly/server/assembly-windows-64.xml +++ b/script/assembly/server/assembly-windows-64.xml @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/assembly.xml b/script/assembly/server/assembly.xml index 981260b70c5..249a0b3e312 100644 --- a/script/assembly/server/assembly.xml +++ b/script/assembly/server/assembly.xml @@ -71,7 +71,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 "> target - /lib + / *.jar diff --git a/script/assembly/server/bin/entrypoint.sh b/script/assembly/server/bin/entrypoint.sh index 19eda3003cd..0a9b0b26e41 100644 --- a/script/assembly/server/bin/entrypoint.sh +++ b/script/assembly/server/bin/entrypoint.sh @@ -17,10 +17,10 @@ # limitations under the License. # project name -SERVER_NAME="hertzbeat-manager" +SERVER_NAME="${project.build.finalName}" # jar name -#JAR_NAME="${project.build.finalName}.jar" +JAR_NAME="${project.build.finalName}.jar" # cd bin cd `dirname $0` @@ -36,10 +36,8 @@ DEPLOY_DIR=`pwd` # if a directory is specified, spring will read all configuration files in the directory CONF_DIR=$DEPLOY_DIR/config MAIN_CLASS="org.apache.hertzbeat.manager.Manager" -LIB_PATH="$DEPLOY_DIR/lib" EXT_LIB_PATH="$DEPLOY_DIR/ext-lib" -TARGET_LIB_PATH="$DEPLOY_DIR/target" -CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*" +CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*" # log dir LOGS_DIR=$DEPLOY_DIR/logs # create logs dir when not exist diff --git a/script/assembly/server/bin/restart.sh b/script/assembly/server/bin/restart.sh index 3ef7f991cfd..30bd4f6e526 100644 --- a/script/assembly/server/bin/restart.sh +++ b/script/assembly/server/bin/restart.sh @@ -16,23 +16,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# cd bin dir -cd `dirname $0` -# bin dir -BIN_DIR=`pwd` -# return root dir -cd .. -# root path dir -DEPLOY_DIR=`pwd` - # restart start time startTime=$(date +%s) echo -e "\033[0;31mCurrent Time is:$(date "+%Y-%m-%d %H:%M:%S") Restart Now!\033[0m" -$DEPLOY_DIR/bin/shutdown.sh +./shutdown.sh echo sleep 2 echo -$DEPLOY_DIR/bin/startup.sh +./startup.sh # restart end time endTime=$(date +%s) echo -e "\033[0;31mCurrent Time is:$(date "+%Y-%m-%d %H:%M:%S") Restart Success!Spend $((endTime - startTime)) seconds \033[0m"; diff --git a/script/assembly/server/bin/shutdown.bat b/script/assembly/server/bin/shutdown.bat index 5cb181d4e41..2c6de23300f 100644 --- a/script/assembly/server/bin/shutdown.bat +++ b/script/assembly/server/bin/shutdown.bat @@ -19,17 +19,17 @@ @echo off setlocal enabledelayedexpansion -set SERVER_NAME="hertzbeat-manager" +set SERVER_NAME="${project.artifactId}" set SERVER_PORT=1157 -echo Start shutdown HertzBeat %SERVER_NAME% +echo Start shutdown HertzBeat %SERVER_NAME% for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%SERVER_PORT%"') do ( echo kill the process %%m who use the port taskkill /pid %%m -t -f - echo Shutdown HertzBeat %SERVER_NAME% Success! + echo Shutdown HertzBeat %SERVER_NAME% Success! goto q ) echo Failed shutdown HertzBeat %SERVER_NAME% diff --git a/script/assembly/server/bin/shutdown.sh b/script/assembly/server/bin/shutdown.sh index 9427134a625..ea38cdfafd4 100644 --- a/script/assembly/server/bin/shutdown.sh +++ b/script/assembly/server/bin/shutdown.sh @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # project name -APPLICATION="hertzbeat-manager" +APPLICATION="${project.artifactId}" # jar file name -APPLICATION_JAR="hertzbeat.manager" +APPLICATION_JAR="${project.build.finalName}.jar" # find the service pid, kill -9 pid PID=$(ps -ef | grep java | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }') diff --git a/script/assembly/server/bin/startup.bat b/script/assembly/server/bin/startup.bat index 81fe636ff16..2647ed07835 100644 --- a/script/assembly/server/bin/startup.bat +++ b/script/assembly/server/bin/startup.bat @@ -19,9 +19,9 @@ @echo off setlocal enabledelayedexpansion -set SERVER_NAME="hertzbeat-manager" +set SERVER_NAME=${project.artifactId} -@REM set JAR_NAME=${project.build.finalName}.jar +set JAR_NAME=${project.build.finalName}.jar rem enter the bin directory cd /d %~dp0 @@ -43,10 +43,8 @@ for /f "tokens=1-5" %%i in ('netstat -ano^|findstr "0.0.0.0:%SERVER_PORT%"') do ) set MAIN_CLASS=org.apache.hertzbeat.manager.Manager set LOGS_DIR=%DEPLOY_DIR%\logs -set LIB_PATH=%DEPLOY_DIR%\lib set EXT_LIB_PATH=%DEPLOY_DIR%\ext-lib -set TARGET_LIB_PATH=%DEPLOY_DIR%\target -set CLASSPATH=%LIB_PATH%\*;%TARGET_LIB_PATH%\*;%EXT_LIB_PATH%\* +set CLASSPATH=%DEPLOY_DIR%\%JAR_NAME%;%EXT_LIB_PATH%\* if not exist %LOGS_DIR% ( mkdir %LOGS_DIR% diff --git a/script/assembly/server/bin/startup.sh b/script/assembly/server/bin/startup.sh index 1385270424f..e3dd9a8533f 100644 --- a/script/assembly/server/bin/startup.sh +++ b/script/assembly/server/bin/startup.sh @@ -17,10 +17,10 @@ # limitations under the License. # project name -SERVER_NAME="hertzbeat-manager" +SERVER_NAME="${project.artifactId}" # jar file name -#JAR_NAME="${project.build.finalName}.jar" +JAR_NAME="${project.build.finalName}.jar" # cd bin dir cd `dirname $0` @@ -74,10 +74,8 @@ if [ -n "$SERVER_PORT" ]; then fi fi MAIN_CLASS="org.apache.hertzbeat.manager.Manager" -LIB_PATH="$DEPLOY_DIR/lib" EXT_LIB_PATH="$DEPLOY_DIR/ext-lib" -TARGET_LIB_PATH="$DEPLOY_DIR/target" -CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*" +CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*" # log dir LOGS_DIR=$DEPLOY_DIR/logs # create logs dir when not exist