chore: import upstream snapshot with attribution
MCP Bash Server CI / Test MCP Bash Server (dev) (push) Has been cancelled
MCP Bash Server CI / Test MCP Bash Server (release) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:11:39 +08:00
commit c8cebdfeee
4654 changed files with 626756 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/bin/sh
# 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.
# project name
SERVER_NAME="${project.build.finalName}"
# jar name
JAR_NAME="${project.build.finalName}.jar"
# cd bin
cd `dirname $0`
# bin dir
BIN_DIR=`pwd`
# return root
cd ..
# root path dir
DEPLOY_DIR=`pwd`
# config dir
# absolute directory of external configuration files, if it is a directory, it should end with '/'you can also directly specify a file.
# if a directory is specified, spring will read all configuration files in the directory
CONF_DIR=$DEPLOY_DIR/config
MAIN_CLASS="org.apache.hertzbeat.startup.HertzBeatApplication"
EXT_LIB_PATH="$DEPLOY_DIR/ext-lib"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
# JVM Configuration
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS=" -Dfile.encoding=UTF-8 -Doracle.jdbc.timezoneAsRegion=false --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED"
else
JAVA_OPTS="${JAVA_OPTS} -Dfile.encoding=UTF-8 -Doracle.jdbc.timezoneAsRegion=false"
fi
# JVM Configuration
JAVA_MEM_OPTS=" -server -XX:SurvivorRatio=6 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$LOGS_DIR"
# load logback config
LOG_IMPL_FILE=logback-spring.xml
LOGGING_CONFIG=""
if [ -f "$CONF_DIR/$LOG_IMPL_FILE" ]
then
LOGGING_CONFIG="-Dlogging.config=$CONF_DIR/$LOG_IMPL_FILE"
fi
CONFIG_FILES=" -Dlogging.path=$LOGS_DIR $LOGGING_CONFIG -Dspring.config.location=$CONF_DIR/ "
echo -e "Starting the HertzBeat $SERVER_NAME ..."
java $JAVA_OPTS $JAVA_MEM_OPTS $CONFIG_FILES -cp $CLASSPATH $MAIN_CLASS --spring.profiles.active=prod
+29
View File
@@ -0,0 +1,29 @@
#!/bin/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.
# 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
echo
sleep 2
echo
./startup.sh
# restart end time
endTime=$(date +%s)
echo -e "\033[0;31mCurrent Time is$(date "+%Y-%m-%d %H:%M:%S") Restart SuccessSpend $((endTime - startTime)) seconds \033[0m";
+38
View File
@@ -0,0 +1,38 @@
@rem
@rem Licensed to the Apache Software Foundation (ASF) under one or more
@rem contributor license agreements. See the NOTICE file distributed with
@rem this work for additional information regarding copyright ownership.
@rem The ASF licenses this file to You under the Apache License, Version 2.0
@rem (the "License"); you may not use this file except in compliance with
@rem the License. You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@title HertzBeat
@echo off
setlocal enabledelayedexpansion
set SERVER_NAME="${project.artifactId}"
set SERVER_PORT=1157
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 Apache HertzBeat %SERVER_NAME% Success!
goto q
)
echo Failed shutdown Apache HertzBeat %SERVER_NAME%
:q
pause
+33
View File
@@ -0,0 +1,33 @@
#!/bin/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.
# project name
APPLICATION="${project.artifactId}"
# jar file name
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 }')
if [[ -z "$PID" ]]
then
echo Apache HertzBeat ${APPLICATION} is already stopped
else
echo kill ${PID}
kill -9 ${PID}
echo Shutdown Apache HertzBeat ${APPLICATION} Success!
fi
+85
View File
@@ -0,0 +1,85 @@
@rem
@rem Licensed to the Apache Software Foundation (ASF) under one or more
@rem contributor license agreements. See the NOTICE file distributed with
@rem this work for additional information regarding copyright ownership.
@rem The ASF licenses this file to You under the Apache License, Version 2.0
@rem (the "License"); you may not use this file except in compliance with
@rem the License. You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@title HertzBeat
@echo off
setlocal enabledelayedexpansion
set SERVER_NAME=${project.artifactId}
set JAR_NAME=${project.build.finalName}.jar
rem enter the bin directory
cd /d %~dp0
cd ..
set DEPLOY_DIR=%~dp0..
echo %DEPLOY_DIR%
set CONF_DIR=%DEPLOY_DIR%\config
echo %CONF_DIR%
set SERVER_PORT=1157
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr "0.0.0.0:%SERVER_PORT%"') do (
echo The HertzBeat %SERVER_NAME% port %SERVER_PORT% already used!
echo exit!
goto q
)
set MAIN_CLASS=org.apache.hertzbeat.startup.HertzBeatApplication
set LOGS_DIR=%DEPLOY_DIR%\logs
set EXT_LIB_PATH=%DEPLOY_DIR%\ext-lib
set CLASSPATH=%DEPLOY_DIR%\%JAR_NAME%;%EXT_LIB_PATH%\*
if not exist %LOGS_DIR% (
mkdir %LOGS_DIR%
)
rem JVM Configuration
set JAVA_OPTS= -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Doracle.jdbc.timezoneAsRegion=false --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
set JAVA_MEM_OPTS= -server -XX:SurvivorRatio=6 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%LOGS_DIR%
set LOGGING_CONFIG=-Dlogging.config=%CONF_DIR%\logback-spring.xml
set CONFIG_FILES= -Dlogging.path=%LOGS_DIR% %LOGGING_CONFIG% -Dspring.config.location=%CONF_DIR%/
echo Starting the HertzBeat %SERVER_NAME% ...
set INNER_EXE=%DEPLOY_DIR%\java\bin\javaw.exe
if not exist %INNER_EXE% (
echo "Use the system environment jdk to start"
start javaw %JAVA_OPTS% %JAVA_MEM_OPTS% %CONFIG_FILES% -cp %CLASSPATH% %MAIN_CLASS%
) else (
echo "Use the inner package jdk to start"
start %INNER_EXE% %JAVA_OPTS% %JAVA_MEM_OPTS% %CONFIG_FILES% -cp %CLASSPATH% %MAIN_CLASS%
)
echo "Service Start Success!"
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%SERVER_PORT%"') do (
echo Service PID: %%m , Port %SERVER_PORT%
goto q
)
:q
pause
+133
View File
@@ -0,0 +1,133 @@
#!/bin/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.
# project name
SERVER_NAME="${project.artifactId}"
# jar file name
JAR_NAME="${project.build.finalName}.jar"
# cd bin dir
cd `dirname $0`
# bin dir
BIN_DIR=`pwd`
# return root dir
cd ..
# root path dir
DEPLOY_DIR=`pwd`
# config dir
# absolute directory of external configuration files, if it is a directory, it should end with '/'you can also directly specify a file.
# if a directory is specified, spring will read all configuration files in the directory
CONF_DIR=$DEPLOY_DIR/config
# server port
SERVER_PORT=1157
PIDS=`ps -ef | grep java | grep "$CONF_DIR" | awk '{print $2}'`
if [ "$1" = "status" ]; then
if [ -n "$PIDS" ]; then
echo "The HertzBeat $SERVER_NAME is running...!"
echo "PID: $PIDS"
exit 0
else
echo "The HertzBeat $SERVER_NAME is stopped"
exit 0
fi
fi
if [ -n "$PIDS" ]; then
echo "ERROR: The HertzBeat $SERVER_NAME already started!"
echo "PID: $PIDS"
exit 1
fi
if [ -n "$SERVER_PORT" ]; then
# linux - find the port whether used
SERVER_PORT_COUNT=`netstat -tln | grep :$SERVER_PORT | wc -l`
if [ $SERVER_PORT_COUNT -gt 0 ]; then
echo "ERROR: netstat the HertzBeat $SERVER_NAME port $SERVER_PORT already used!"
exit 1
fi
# mac - find the port whether used
LSOF_AVA=`command -v lsof | wc -l`
if [ $LSOF_AVA -gt 0 ]; then
SERVER_PORT_COUNT=`lsof -i:$SERVER_PORT | grep java | wc -l`
if [ $SERVER_PORT_COUNT -gt 0 ]; then
echo "ERROR: lsof the HertzBeat $SERVER_NAME port $SERVER_PORT already used!"
exit 1
fi
fi
fi
MAIN_CLASS="org.apache.hertzbeat.startup.HertzBeatApplication"
EXT_LIB_PATH="$DEPLOY_DIR/ext-lib"
CLASSPATH="$DEPLOY_DIR/$JAR_NAME:$EXT_LIB_PATH/*"
# log dir
LOGS_DIR=$DEPLOY_DIR/logs
# create logs dir when not exist
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
# JVM Configuration
JAVA_OPTS=" -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Doracle.jdbc.timezoneAsRegion=false --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED"
JAVA_MEM_OPTS=" -server -XX:SurvivorRatio=6 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$LOGS_DIR"
# load logback config
LOG_IMPL_FILE=logback-spring.xml
LOGGING_CONFIG=""
if [ -f "$CONF_DIR/$LOG_IMPL_FILE" ]
then
LOGGING_CONFIG="-Dlogging.config=$CONF_DIR/$LOG_IMPL_FILE"
fi
CONFIG_FILES=" -Dlogging.path=$LOGS_DIR $LOGGING_CONFIG -Dspring.config.location=$CONF_DIR/ "
echo -e "You can review logs at hertzbeat/logs"
echo -e "Starting the HertzBeat $SERVER_NAME ..."
if [ -f "./java/bin/java" ]; then
echo -e "Use the inner package jdk to start"
nohup ./java/bin/java $JAVA_OPTS $JAVA_MEM_OPTS $CONFIG_FILES -cp $CLASSPATH $MAIN_CLASS >logs/startup.log 2>&1 &
else
JAVA_EXIST=`which java | grep bin | wc -l`
if [ $JAVA_EXIST -le 0 ]; then
echo -e "ERROR: there is no java${java.version}+ environment, please config java environment."
exit 1
fi
echo -e "Use the system environment jdk to start"
nohup java $JAVA_OPTS $JAVA_MEM_OPTS $CONFIG_FILES -cp $CLASSPATH $MAIN_CLASS >logs/startup.log 2>&1 &
fi
COUNT=0
while [ $COUNT -lt 1 ]; do
echo "... "
sleep 1
if [ -n "$SERVER_PORT" ]; then
COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
else
COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
fi
if [ $COUNT -gt 0 ]; then
break
fi
done
echo "Service Start Success!"
PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
echo "Service PID: $PIDS"