test-config-fix.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # 配置修复验证脚本
  3. # 使用方法: ./test-config-fix.sh
  4. # 颜色输出
  5. RED='\033[0;31m'
  6. GREEN='\033[0;32m'
  7. YELLOW='\033[1;33m'
  8. NC='\033[0m' # No Color
  9. print_message() {
  10. local color=$1
  11. local message=$2
  12. echo -e "${color}${message}${NC}"
  13. }
  14. print_message $GREEN "=== 多实例配置修复验证脚本 ==="
  15. # 检查JAR文件
  16. JAR_NAME="ruoyi-admin.jar"
  17. if [ ! -f "$JAR_NAME" ]; then
  18. print_message $RED "错误: $JAR_NAME 文件不存在!"
  19. print_message $YELLOW "请先执行 mvn clean package -Pprod 编译项目"
  20. exit 1
  21. fi
  22. print_message $GREEN "✓ JAR文件存在"
  23. # 检查配置文件
  24. CONFIG_FILES=(
  25. "backend/ruoyi-admin/src/main/resources/application-prod-9900.yml"
  26. "backend/ruoyi-admin/src/main/resources/application-prod-9901.yml"
  27. "backend/ruoyi-admin/src/main/resources/application-prod-9902.yml"
  28. "backend/ruoyi-admin/src/main/resources/application-prod-9903.yml"
  29. )
  30. for config_file in "${CONFIG_FILES[@]}"; do
  31. if [ -f "$config_file" ]; then
  32. # 检查是否包含spring.profiles.include
  33. if grep -q "spring.profiles.include" "$config_file"; then
  34. print_message $RED "✗ $config_file 仍包含 spring.profiles.include"
  35. else
  36. print_message $GREEN "✓ $config_file 配置正确"
  37. fi
  38. else
  39. print_message $RED "✗ $config_file 文件不存在"
  40. fi
  41. done
  42. # 检查启动脚本
  43. START_SCRIPT="docs/部署文档/杭州第一技师部署文档/start-multi-instance.sh"
  44. if [ -f "$START_SCRIPT" ]; then
  45. if grep -q "spring.profiles.active=prod,\$profile" "$START_SCRIPT"; then
  46. print_message $GREEN "✓ 启动脚本配置正确"
  47. else
  48. print_message $RED "✗ 启动脚本配置错误"
  49. fi
  50. else
  51. print_message $RED "✗ 启动脚本不存在"
  52. fi
  53. print_message $GREEN ""
  54. print_message $GREEN "=== 验证完成 ==="
  55. print_message $YELLOW "如果所有检查都通过,可以尝试启动实例:"
  56. print_message $YELLOW " ./start-multi-instance.sh start 9900"