mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-08-08 13:58:53 +00:00
微服务快速启动脚本
This commit is contained in:
parent
866bf8b2fe
commit
fba8ec8f8d
286
jeecg-boot/start-cloud.bat
Normal file
286
jeecg-boot/start-cloud.bat
Normal file
@ -0,0 +1,286 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions EnableDelayedExpansion
|
||||
chcp 65001 >nul
|
||||
|
||||
rem =============================================================================
|
||||
rem JeecgBoot 微服务启动脚本,适用于 Windows CMD / PowerShell。
|
||||
rem
|
||||
rem Maven Profiles: SpringCloud + dev
|
||||
rem 启动顺序: Nacos(8848),然后启动 System(7001) + Demo(7002) + Gateway(9999)
|
||||
rem
|
||||
rem 用法:
|
||||
rem start-cloud.bat 先构建,再启动所有微服务
|
||||
rem start-cloud.bat start 跳过构建,直接启动已有 jar
|
||||
rem start-cloud.bat build 仅构建,不启动
|
||||
rem start-cloud.bat stop 按端口停止服务
|
||||
rem start-cloud.bat restart 停止后重新启动
|
||||
rem start-cloud.bat status 查看端口占用状态
|
||||
rem =============================================================================
|
||||
|
||||
set "PROJ_ROOT=%~dp0"
|
||||
if "%PROJ_ROOT:~-1%"=="\" set "PROJ_ROOT=%PROJ_ROOT:~0,-1%"
|
||||
set "CLOUD_DIR=%PROJ_ROOT%\jeecg-server-cloud"
|
||||
set "MAVEN_PROFILES=SpringCloud,dev"
|
||||
|
||||
set "VERSION="
|
||||
for /f "usebackq tokens=2 delims=>" %%v in (`findstr /r /c:"^[ ]*<version>[^<]*</version>" "%PROJ_ROOT%\pom.xml" 2^>nul`) do (
|
||||
if not defined VERSION for /f "tokens=1 delims=<" %%x in ("%%v") do set "VERSION=%%x"
|
||||
)
|
||||
if not defined VERSION set "VERSION=3.9.2"
|
||||
|
||||
set "ACTION=%~1"
|
||||
if "%ACTION%"=="" (
|
||||
call :do_build
|
||||
if errorlevel 1 exit /b 1
|
||||
call :do_start
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
|
||||
if /I "%ACTION%"=="build" (
|
||||
call :do_build
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
if /I "%ACTION%"=="start" (
|
||||
call :do_start
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
if /I "%ACTION%"=="stop" (
|
||||
call :do_stop
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
if /I "%ACTION%"=="restart" (
|
||||
call :do_stop
|
||||
timeout /t 2 /nobreak >nul
|
||||
call :do_start
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
if /I "%ACTION%"=="status" (
|
||||
call :do_status
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
|
||||
call :usage
|
||||
exit /b 1
|
||||
|
||||
:info
|
||||
echo [INFO] %~1
|
||||
exit /b 0
|
||||
|
||||
:warn
|
||||
echo [WARN] %~1
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo [ERROR] %~1
|
||||
exit /b 0
|
||||
|
||||
:step
|
||||
echo [STEP] %~1
|
||||
exit /b 0
|
||||
|
||||
:pid_by_port
|
||||
set "PID_FOUND="
|
||||
for /f "tokens=5" %%p in ('netstat -ano 2^>nul ^| findstr /C:":%~1 " ^| findstr /I "LISTENING"') do (
|
||||
set "PID_FOUND=%%p"
|
||||
goto :pid_by_port_done
|
||||
)
|
||||
:pid_by_port_done
|
||||
exit /b 0
|
||||
|
||||
:wait_for_nacos
|
||||
set "NACOS_PORT=%~1"
|
||||
set "MAX_WAIT=%~2"
|
||||
set /a WAITED=0
|
||||
|
||||
call :info "等待 Nacos (端口 %NACOS_PORT%) 启动..."
|
||||
:wait_for_nacos_loop
|
||||
set "HTTP_STATUS=000"
|
||||
for /f "delims=" %%s in ('curl -s -o nul -w "%%{http_code}" "http://localhost:%NACOS_PORT%/nacos/v1/console/health/readiness" 2^>nul') do (
|
||||
set "HTTP_STATUS=%%s"
|
||||
)
|
||||
|
||||
if "%HTTP_STATUS%"=="200" (
|
||||
echo.
|
||||
call :info "Nacos (端口 %NACOS_PORT%) 已就绪"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
if %WAITED% GEQ %MAX_WAIT% (
|
||||
echo.
|
||||
call :error "Nacos (端口 %NACOS_PORT%) 启动超时 (%MAX_WAIT%s)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
<nul set /p ".=."
|
||||
timeout /t 3 /nobreak >nul
|
||||
set /a WAITED+=3
|
||||
goto :wait_for_nacos_loop
|
||||
|
||||
:start_service
|
||||
set "SVC_NAME=%~1"
|
||||
set "SVC_PORT=%~2"
|
||||
set "SVC_MODULE=%~3"
|
||||
set "MODULE_DIR=%CLOUD_DIR%\%SVC_MODULE%"
|
||||
set "JAR_FILE=%MODULE_DIR%\target\%SVC_MODULE%-%VERSION%.jar"
|
||||
|
||||
call :pid_by_port "%SVC_PORT%"
|
||||
if defined PID_FOUND (
|
||||
call :warn "%SVC_NAME% (端口 %SVC_PORT%) 已在运行 (PID: %PID_FOUND%),跳过"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
if not exist "%JAR_FILE%" (
|
||||
call :error "%SVC_NAME% jar 不存在: %JAR_FILE%"
|
||||
call :error "请先执行: start-cloud.bat build"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call :info "启动 %SVC_NAME% (端口 %SVC_PORT%) ..."
|
||||
start "%SVC_NAME%:%SVC_PORT%" /D "%MODULE_DIR%" cmd /k "title %SVC_NAME%:%SVC_PORT% && java -jar target\%SVC_MODULE%-%VERSION%.jar & pause"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
timeout /t 1 /nobreak >nul
|
||||
exit /b 0
|
||||
|
||||
:stop_service
|
||||
set "SVC_NAME=%~1"
|
||||
set "SVC_PORT=%~2"
|
||||
|
||||
call :pid_by_port "%SVC_PORT%"
|
||||
if defined PID_FOUND (
|
||||
call :info "停止 %SVC_NAME% (端口 %SVC_PORT%, PID: %PID_FOUND%)..."
|
||||
taskkill /F /PID %PID_FOUND% >nul 2>nul
|
||||
timeout /t 1 /nobreak >nul
|
||||
) else (
|
||||
call :info "%SVC_NAME% (端口 %SVC_PORT%) 未运行"
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:preflight
|
||||
where java >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
call :error "未找到 java,请安装 JDK 17+ 并配置 JAVA_HOME"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
where mvn >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
call :error "未找到 mvn,请安装 Maven 并配置 PATH"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set "JAVA_VERSION="
|
||||
for /f "delims=" %%j in ('java -version 2^>^&1 ^| findstr /I "version"') do (
|
||||
if not defined JAVA_VERSION set "JAVA_VERSION=%%j"
|
||||
)
|
||||
|
||||
set "MAVEN_VERSION="
|
||||
for /f "delims=" %%m in ('mvn --version 2^>^&1') do (
|
||||
if not defined MAVEN_VERSION set "MAVEN_VERSION=%%m"
|
||||
)
|
||||
|
||||
call :info "Java: %JAVA_VERSION%"
|
||||
call :info "Maven: %MAVEN_VERSION%"
|
||||
exit /b 0
|
||||
|
||||
:do_build
|
||||
call :preflight
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
call :step "开始 Maven 构建 (profiles: %MAVEN_PROFILES%)..."
|
||||
pushd "%PROJ_ROOT%"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
call :step "[1/2] 构建 Nacos ..."
|
||||
call mvn clean package -DskipTests -f "%CLOUD_DIR%\jeecg-cloud-nacos\pom.xml"
|
||||
if errorlevel 1 (
|
||||
set "BUILD_RC=!ERRORLEVEL!"
|
||||
popd
|
||||
exit /b !BUILD_RC!
|
||||
)
|
||||
|
||||
call :step "[2/2] 构建云模块 ..."
|
||||
call mvn clean package -P "%MAVEN_PROFILES%" -DskipTests
|
||||
if errorlevel 1 (
|
||||
set "BUILD_RC=!ERRORLEVEL!"
|
||||
popd
|
||||
exit /b !BUILD_RC!
|
||||
)
|
||||
|
||||
popd
|
||||
call :info "构建完成"
|
||||
exit /b 0
|
||||
|
||||
:do_start
|
||||
call :step "启动微服务..."
|
||||
|
||||
call :start_service "Nacos" "8848" "jeecg-cloud-nacos"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
call :wait_for_nacos "8848" "120"
|
||||
if errorlevel 1 (
|
||||
call :error "Nacos 启动失败,终止后续服务"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call :start_service "System" "7001" "jeecg-system-cloud-start"
|
||||
if errorlevel 1 exit /b 1
|
||||
timeout /t 1 /nobreak >nul
|
||||
|
||||
call :start_service "Demo" "7002" "jeecg-demo-cloud-start"
|
||||
if errorlevel 1 exit /b 1
|
||||
timeout /t 1 /nobreak >nul
|
||||
|
||||
call :start_service "Gateway" "9999" "jeecg-cloud-gateway"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
echo.
|
||||
call :info "============================================"
|
||||
call :info " Nacos -> http://localhost:8848/nacos"
|
||||
call :info " System -> http://localhost:7001"
|
||||
call :info " Demo -> http://localhost:7002"
|
||||
call :info " Gateway -> http://localhost:9999"
|
||||
call :info "============================================"
|
||||
exit /b 0
|
||||
|
||||
:do_stop
|
||||
call :step "停止所有微服务..."
|
||||
call :stop_service "Nacos" "8848"
|
||||
call :stop_service "System" "7001"
|
||||
call :stop_service "Demo" "7002"
|
||||
call :stop_service "Gateway" "9999"
|
||||
call :info "已全部停止"
|
||||
exit /b 0
|
||||
|
||||
:print_status
|
||||
set "STATUS_PORT=%~1"
|
||||
set "STATUS_NAME=%~2"
|
||||
call :pid_by_port "%STATUS_PORT%"
|
||||
if defined PID_FOUND (
|
||||
echo %STATUS_PORT% %STATUS_NAME% RUNNING %PID_FOUND%
|
||||
) else (
|
||||
echo %STATUS_PORT% %STATUS_NAME% STOPPED -
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
:do_status
|
||||
echo.
|
||||
echo 端口 服务 状态 PID
|
||||
echo ---------- ---------- ---------- --------
|
||||
call :print_status "8848" "Nacos"
|
||||
call :print_status "7001" "System"
|
||||
call :print_status "7002" "Demo"
|
||||
call :print_status "9999" "Gateway"
|
||||
echo.
|
||||
exit /b 0
|
||||
|
||||
:usage
|
||||
echo 用法: start-cloud.bat [build^|start^|stop^|restart^|status]
|
||||
echo.
|
||||
echo ^(无参数^) 构建并启动所有微服务
|
||||
echo build 仅构建, 不启动
|
||||
echo start 跳过构建, 直接启动 ^(使用已有 jar^)
|
||||
echo stop 停止所有服务 ^(按端口杀进程^)
|
||||
echo restart 重启所有服务
|
||||
echo status 查看各端口占用状态
|
||||
exit /b 0
|
||||
@ -1,282 +0,0 @@
|
||||
#!/bin/bash
|
||||
#=============================================================================
|
||||
# JeecgBoot 微服务启动脚本
|
||||
# 适用环境: Windows Git Bash / JDK 17+ / Maven
|
||||
#
|
||||
# Maven Profiles: SpringCloud + dev (对应 IDEA Maven 面板勾选的两项)
|
||||
#
|
||||
# 启动顺序: Nacos(8848) -> System(7001) + Demo(7002) + Gateway(9999)
|
||||
#
|
||||
# 用法:
|
||||
# ./start-cloud.sh # 先构建再启动所有服务 (默认)
|
||||
# ./start-cloud.sh start # 跳过构建,直接启动 (使用已有 jar)
|
||||
# ./start-cloud.sh build # 仅构建,不启动
|
||||
# ./start-cloud.sh stop # 停止所有服务 (按端口杀进程)
|
||||
# ./start-cloud.sh status # 查看各端口占用状态
|
||||
#=============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# 自动推断: 脚本所在目录即项目根目录
|
||||
PROJ_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
CLOUD_DIR="$PROJ_ROOT/jeecg-server-cloud"
|
||||
|
||||
# Maven 激活的 profile (对应 IDEA Maven 面板勾选的两项)
|
||||
MAVEN_PROFILES="SpringCloud,dev"
|
||||
|
||||
# 从 pom.xml 读取版本号 (失败时用默认值)
|
||||
VERSION=$(grep -oPm1 '<version>\K[^<]+' "$PROJ_ROOT/pom.xml" 2>/dev/null | head -1)
|
||||
[ -z "$VERSION" ] && VERSION="3.9.2"
|
||||
|
||||
# 服务配置: 名称|端口|模块目录
|
||||
SERVICES=(
|
||||
"Nacos|8848|jeecg-cloud-nacos"
|
||||
"System|7001|jeecg-system-cloud-start"
|
||||
"Demo|7002|jeecg-demo-cloud-start"
|
||||
"Gateway|9999|jeecg-cloud-gateway"
|
||||
)
|
||||
|
||||
# ANSI 颜色
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
step() { echo -e "${CYAN}[STEP]${NC} $1"; }
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 路径转换: F:/xxx/yyy -> F:\xxx\yyy (cmd.exe 格式)
|
||||
#-----------------------------------------------------------------------------
|
||||
to_win_path() {
|
||||
echo "$1" | sed 's|/|\\|g'
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 通过端口查进程 PID
|
||||
#-----------------------------------------------------------------------------
|
||||
pid_by_port() {
|
||||
local port=$1
|
||||
netstat -ano 2>/dev/null | grep ":$port " | grep -i LISTENING | awk '{print $NF}' | head -1
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 等待 Nacos 健康检查就绪
|
||||
#-----------------------------------------------------------------------------
|
||||
wait_for_nacos() {
|
||||
local port=${1:-8848}
|
||||
local max_wait=${2:-90}
|
||||
local count=0
|
||||
|
||||
info "等待 Nacos (端口 $port) 启动..."
|
||||
while [ $count -lt $max_wait ]; do
|
||||
local status
|
||||
status=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:$port/nacos/v1/console/health/readiness" 2>/dev/null || echo "000")
|
||||
if [ "$status" = "200" ]; then
|
||||
info "Nacos (端口 $port) 已就绪"
|
||||
return 0
|
||||
fi
|
||||
sleep 3
|
||||
count=$((count + 3))
|
||||
echo -n "."
|
||||
done
|
||||
echo ""
|
||||
error "Nacos (端口 $port) 启动超时 (${max_wait}s)"
|
||||
return 1
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 启动单个服务 (在独立 cmd 窗口中运行)
|
||||
#-----------------------------------------------------------------------------
|
||||
start_service() {
|
||||
local name=$1
|
||||
local port=$2
|
||||
local module=$3
|
||||
local module_dir="$CLOUD_DIR/$module"
|
||||
|
||||
# 检查是否已在运行
|
||||
local existing_pid
|
||||
existing_pid=$(pid_by_port "$port")
|
||||
if [ -n "$existing_pid" ]; then
|
||||
warn "$name (端口 $port) 已在运行 (PID: $existing_pid),跳过"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 检查 jar 是否存在
|
||||
local jar_file="$module_dir/target/${module}-${VERSION}.jar"
|
||||
if [ ! -f "$jar_file" ]; then
|
||||
error "$name jar 不存在: $jar_file"
|
||||
error "请先执行: ./start-cloud.sh build"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local win_dir
|
||||
win_dir=$(to_win_path "$module_dir")
|
||||
|
||||
info "启动 $name (端口 $port) ..."
|
||||
# 在独立 cmd 窗口中启动 java -jar
|
||||
cmd //c start "$name:$port" cmd /k "title $name:$port && cd /d $win_dir && java -jar target\\${module}-${VERSION}.jar && pause" 2>/dev/null
|
||||
|
||||
sleep 1
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 停止单个服务 (按端口杀进程)
|
||||
#-----------------------------------------------------------------------------
|
||||
stop_service() {
|
||||
local name=$1
|
||||
local port=$2
|
||||
local pid
|
||||
|
||||
pid=$(pid_by_port "$port")
|
||||
if [ -n "$pid" ]; then
|
||||
info "停止 $name (端口 $port, PID: $pid)..."
|
||||
taskkill //F //PID "$pid" 2>/dev/null || true
|
||||
sleep 1
|
||||
else
|
||||
info "$name (端口 $port) 未运行"
|
||||
fi
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 预检: Java + Maven
|
||||
#-----------------------------------------------------------------------------
|
||||
preflight() {
|
||||
if ! command -v java &>/dev/null; then
|
||||
error "未找到 java,请安装 JDK 17+ 并配置 JAVA_HOME"
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v mvn &>/dev/null; then
|
||||
error "未找到 mvn,请安装 Maven 并配置 PATH"
|
||||
exit 1
|
||||
fi
|
||||
local jver
|
||||
jver=$(java -version 2>&1 | head -1 | grep -oP '"\K[^"]+')
|
||||
info "Java: $jver"
|
||||
info "Maven: $(mvn --version 2>&1 | head -1)"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 构建
|
||||
#-----------------------------------------------------------------------------
|
||||
do_build() {
|
||||
preflight
|
||||
step "开始 Maven 构建 (profiles: $MAVEN_PROFILES)..."
|
||||
|
||||
cd "$PROJ_ROOT"
|
||||
|
||||
# 1. 先单独构建 Nacos (Spring Boot 2.7.18, 与主项目不同)
|
||||
step "[1/2] 构建 Nacos ..."
|
||||
mvn clean package -DskipTests -f "$CLOUD_DIR/jeecg-cloud-nacos/pom.xml"
|
||||
|
||||
# 2. 构建其余微服务模块 (Spring Boot 3.5.5)
|
||||
step "[2/2] 构建云模块 ..."
|
||||
mvn clean package -P "$MAVEN_PROFILES" -DskipTests
|
||||
|
||||
info "构建完成"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 启动所有服务
|
||||
#-----------------------------------------------------------------------------
|
||||
do_start() {
|
||||
step "启动微服务..."
|
||||
|
||||
# 1. 先启动 Nacos
|
||||
start_service "Nacos" "8848" "jeecg-cloud-nacos"
|
||||
|
||||
# 2. 等待 Nacos 就绪 (其他服务依赖 Nacos 注册中心)
|
||||
wait_for_nacos "8848" 120 || {
|
||||
error "Nacos 启动失败,终止后续服务"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 3. Nacos 就绪后启动其余服务
|
||||
start_service "System" "7001" "jeecg-system-cloud-start"
|
||||
sleep 1
|
||||
start_service "Demo" "7002" "jeecg-demo-cloud-start"
|
||||
sleep 1
|
||||
start_service "Gateway" "9999" "jeecg-cloud-gateway"
|
||||
|
||||
echo ""
|
||||
info "============================================"
|
||||
info " Nacos -> http://localhost:8848/nacos"
|
||||
info " System -> http://localhost:7001"
|
||||
info " Demo -> http://localhost:7002"
|
||||
info " Gateway -> http://localhost:9999"
|
||||
info "============================================"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 停止所有服务
|
||||
#-----------------------------------------------------------------------------
|
||||
do_stop() {
|
||||
step "停止所有微服务..."
|
||||
for svc in "${SERVICES[@]}"; do
|
||||
IFS='|' read -r name port module <<< "$svc"
|
||||
stop_service "$name" "$port"
|
||||
done
|
||||
info "已全部停止"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 查看状态
|
||||
#-----------------------------------------------------------------------------
|
||||
do_status() {
|
||||
echo ""
|
||||
printf " %-10s %-10s %-10s %s\n" "端口" "服务" "状态" "PID"
|
||||
printf " %-10s %-10s %-10s %s\n" "----------" "----------" "----------" "--------"
|
||||
for svc in "${SERVICES[@]}"; do
|
||||
IFS='|' read -r name port module <<< "$svc"
|
||||
local pid
|
||||
pid=$(pid_by_port "$port")
|
||||
if [ -n "$pid" ]; then
|
||||
printf " %-10s %-10s ${GREEN}%-10s${NC} %s\n" "$port" "$name" "RUNNING" "$pid"
|
||||
else
|
||||
printf " %-10s %-10s ${RED}%-10s${NC} -\n" "$port" "$name" "STOPPED"
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
}
|
||||
|
||||
#=============================================================================
|
||||
# 主入口
|
||||
#=============================================================================
|
||||
case "${1:-}" in
|
||||
build)
|
||||
do_build
|
||||
;;
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
status)
|
||||
do_status
|
||||
;;
|
||||
restart)
|
||||
do_stop
|
||||
sleep 2
|
||||
do_start
|
||||
;;
|
||||
"")
|
||||
# 默认: 构建 + 启动
|
||||
do_build
|
||||
do_start
|
||||
;;
|
||||
*)
|
||||
echo "用法: $0 [build|start|stop|restart|status]"
|
||||
echo ""
|
||||
echo " (无参数) 构建并启动所有微服务"
|
||||
echo " build 仅构建, 不启动"
|
||||
echo " start 跳过构建, 直接启动 (使用已有 jar)"
|
||||
echo " stop 停止所有服务 (按端口杀进程)"
|
||||
echo " restart 重启所有服务"
|
||||
echo " status 查看各端口占用状态"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
x
Reference in New Issue
Block a user