66 lines
2.0 KiB
Bash
66 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
# 配置修复验证脚本
|
|
# 使用方法: ./test-config-fix.sh
|
|
|
|
# 颜色输出
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
print_message() {
|
|
local color=$1
|
|
local message=$2
|
|
echo -e "${color}${message}${NC}"
|
|
}
|
|
|
|
print_message $GREEN "=== 多实例配置修复验证脚本 ==="
|
|
|
|
# 检查JAR文件
|
|
JAR_NAME="ruoyi-admin.jar"
|
|
if [ ! -f "$JAR_NAME" ]; then
|
|
print_message $RED "错误: $JAR_NAME 文件不存在!"
|
|
print_message $YELLOW "请先执行 mvn clean package -Pprod 编译项目"
|
|
exit 1
|
|
fi
|
|
|
|
print_message $GREEN "✓ JAR文件存在"
|
|
|
|
# 检查配置文件
|
|
CONFIG_FILES=(
|
|
"backend/ruoyi-admin/src/main/resources/application-prod-9900.yml"
|
|
"backend/ruoyi-admin/src/main/resources/application-prod-9901.yml"
|
|
"backend/ruoyi-admin/src/main/resources/application-prod-9902.yml"
|
|
"backend/ruoyi-admin/src/main/resources/application-prod-9903.yml"
|
|
)
|
|
|
|
for config_file in "${CONFIG_FILES[@]}"; do
|
|
if [ -f "$config_file" ]; then
|
|
# 检查是否包含spring.profiles.include
|
|
if grep -q "spring.profiles.include" "$config_file"; then
|
|
print_message $RED "✗ $config_file 仍包含 spring.profiles.include"
|
|
else
|
|
print_message $GREEN "✓ $config_file 配置正确"
|
|
fi
|
|
else
|
|
print_message $RED "✗ $config_file 文件不存在"
|
|
fi
|
|
done
|
|
|
|
# 检查启动脚本
|
|
START_SCRIPT="docs/部署文档/杭州第一技师部署文档/start-multi-instance.sh"
|
|
if [ -f "$START_SCRIPT" ]; then
|
|
if grep -q "spring.profiles.active=prod,\$profile" "$START_SCRIPT"; then
|
|
print_message $GREEN "✓ 启动脚本配置正确"
|
|
else
|
|
print_message $RED "✗ 启动脚本配置错误"
|
|
fi
|
|
else
|
|
print_message $RED "✗ 启动脚本不存在"
|
|
fi
|
|
|
|
print_message $GREEN ""
|
|
print_message $GREEN "=== 验证完成 ==="
|
|
print_message $YELLOW "如果所有检查都通过,可以尝试启动实例:"
|
|
print_message $YELLOW " ./start-multi-instance.sh start 9900" |