Skip to content

Commit

Permalink
[improve] modify bin shells (#2723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aias00 authored Sep 19, 2024
1 parent 001e76d commit febc911
Show file tree
Hide file tree
Showing 24 changed files with 74 additions and 44 deletions.
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly-linux-amd64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly-linux-arm64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly-macos-amd64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly-macos-arm64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly-windows-64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/collector/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/collector/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# limitations under the License.

# project name
SERVER_NAME="${project.build.finalName}"
SERVER_NAME="hertzbeat-collector"

# jar name
JAR_NAME="${project.build.finalName}.jar"
#JAR_NAME="${project.build.finalName}.jar"

# cd bin
cd `dirname $0`
Expand All @@ -34,8 +34,10 @@ 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"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
TARGET_LIB_PATH="$DEPLOY_DIR/target"
CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
Expand Down
13 changes: 11 additions & 2 deletions script/assembly/collector/bin/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@
# 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"
./shutdown.sh
$DEPLOY_DIR/bin/shutdown.sh
echo
sleep 2
echo
./startup.sh
$DEPLOY_DIR/bin/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";
6 changes: 3 additions & 3 deletions script/assembly/collector/bin/shutdown.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
@echo off
setlocal enabledelayedexpansion

set SERVER_NAME="${project.artifactId}"
set SERVER_NAME="hertzbeat-collector"


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%
Expand Down
4 changes: 2 additions & 2 deletions script/assembly/collector/bin/shutdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# project name
APPLICATION="${project.artifactId}"
APPLICATION="hertzbeat-collector"

# jar file name
APPLICATION_JAR="${project.build.finalName}.jar"
APPLICATION_JAR="hertzbeat.collector"

# find the service pid, kill -9 pid
PID=$(ps -ef | grep java | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }')
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/collector/bin/startup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
@echo off
setlocal enabledelayedexpansion

set SERVER_NAME=${project.artifactId}
set SERVER_NAME="hertzbeat-collector"

set JAR_NAME=${project.build.finalName}.jar
@REM set JAR_NAME=${project.build.finalName}.jar

rem enter the bin directory
cd /d %~dp0
Expand All @@ -43,8 +43,10 @@ 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 CLASSPATH=%DEPLOY_DIR%\%JAR_NAME%;%EXT_LIB_PATH%\*
set TARGET_LIB_PATH=%DEPLOY_DIR%\target
set CLASSPATH=%LIB_PATH%\*;%TARGET_LIB_PATH%\*;%EXT_LIB_PATH%\*

if not exist %LOGS_DIR% (
mkdir %LOGS_DIR%
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/collector/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# limitations under the License.

# project name
SERVER_NAME="${project.artifactId}"
SERVER_NAME="hertzbeat-collector"

# jar file name
JAR_NAME="${project.build.finalName}.jar"
#JAR_NAME="${project.build.finalName}.jar"

# cd bin dir
cd `dirname $0`
Expand Down Expand Up @@ -72,8 +72,10 @@ 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"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
TARGET_LIB_PATH="$DEPLOY_DIR/target"
CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly-linux-amd64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly-linux-arm64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly-macos-amd64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly-macos-arm64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly-windows-64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion script/assembly/server/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ http://maven.apache.org/ASSEMBLY/2.0.0 ">
<!-- Pack the startup jar in the target directory to the directory-->
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/server/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# limitations under the License.

# project name
SERVER_NAME="${project.build.finalName}"
SERVER_NAME="hertzbeat-manager"

# jar name
JAR_NAME="${project.build.finalName}.jar"
#JAR_NAME="${project.build.finalName}.jar"

# cd bin
cd `dirname $0`
Expand All @@ -36,8 +36,10 @@ 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"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
TARGET_LIB_PATH="$DEPLOY_DIR/target"
CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
Expand Down
13 changes: 11 additions & 2 deletions script/assembly/server/bin/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@
# 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"
./shutdown.sh
$DEPLOY_DIR/bin/shutdown.sh
echo
sleep 2
echo
./startup.sh
$DEPLOY_DIR/bin/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";
6 changes: 3 additions & 3 deletions script/assembly/server/bin/shutdown.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
@echo off
setlocal enabledelayedexpansion

set SERVER_NAME="${project.artifactId}"
set SERVER_NAME="hertzbeat-manager"


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%
Expand Down
4 changes: 2 additions & 2 deletions script/assembly/server/bin/shutdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# project name
APPLICATION="${project.artifactId}"
APPLICATION="hertzbeat-manager"

# jar file name
APPLICATION_JAR="${project.build.finalName}.jar"
APPLICATION_JAR="hertzbeat.manager"

# find the service pid, kill -9 pid
PID=$(ps -ef | grep java | grep "${APPLICATION_JAR}" | grep -v grep | awk '{ print $2 }')
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/server/bin/startup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
@echo off
setlocal enabledelayedexpansion

set SERVER_NAME=${project.artifactId}
set SERVER_NAME="hertzbeat-manager"

set JAR_NAME=${project.build.finalName}.jar
@REM set JAR_NAME=${project.build.finalName}.jar

rem enter the bin directory
cd /d %~dp0
Expand All @@ -43,8 +43,10 @@ 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 CLASSPATH=%DEPLOY_DIR%\%JAR_NAME%;%EXT_LIB_PATH%\*
set TARGET_LIB_PATH=%DEPLOY_DIR%\target
set CLASSPATH=%LIB_PATH%\*;%TARGET_LIB_PATH%\*;%EXT_LIB_PATH%\*

if not exist %LOGS_DIR% (
mkdir %LOGS_DIR%
Expand Down
8 changes: 5 additions & 3 deletions script/assembly/server/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# limitations under the License.

# project name
SERVER_NAME="${project.artifactId}"
SERVER_NAME="hertzbeat-manager"

# jar file name
JAR_NAME="${project.build.finalName}.jar"
#JAR_NAME="${project.build.finalName}.jar"

# cd bin dir
cd `dirname $0`
Expand Down Expand Up @@ -74,8 +74,10 @@ 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"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
TARGET_LIB_PATH="$DEPLOY_DIR/target"
CLASSPATH="$LIB_PATH/*:$TARGET_LIB_PATH/*:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
Expand Down

0 comments on commit febc911

Please sign in to comment.