一键批处理启动微服务

  • 微服务一键启动脚本:
    拉代码并构建的批处理脚本:
    set company_api_dir=%workspace_dir%\company-core\api
    cd /d %company_api_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true

    新打开一个window窗口,启动服务选择激活方式为本地的配置文件,并等待15秒后执行下面的命令 

    start cmd /k  "java -jar -Dspring.profiles.active=local %workspace_dir%\company-core\ucenter\company-service-ucenter\target\company-service-ucenter.jar"
    ping -n 15 127.1>nul
    完整脚本如下
    @echo off
    set workspace_dir=D:\company-workspace\workspace_company_git_3.0
    ::taskkill /f /t /im cmd.exe
    call rabbitmq-start.bat
    start /D "D:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.5\sbin" rabbitmq-server.bat
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目company_api  
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    set company_api_dir=%workspace_dir%\company-core\api
    cd /d %company_api_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目company_common
    rem -------------------------------------------------------------------  
    rem ------------------------------------------------------------------- 
    set company_common_dir=%workspace_dir%\company-core\common
    cd /d %company_common_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-api
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_api_dir=%workspace_dir%\project\j2ee\project-api
    cd /d %project_api_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目ucenter
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set ucenter_dir=%workspace_dir%\company-core\ucenter
    cd /d %ucenter_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-api
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_api_dir=%workspace_dir%\project\j2ee\project-api
    cd /d %project_api_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-api
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_api_dir=%workspace_dir%\project\j2ee\project-service-api
    cd /d %project_service_api_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-order
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_order_dir=%workspace_dir%\project\j2ee\project-service-order
    cd /d %project_service_order_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-filing
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_filing_dir=%workspace_dir%\project\j2ee\project-service-filing
    cd /d %project_service_filing_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-identification
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_identification_dir=%workspace_dir%\project\j2ee\project-service-identification
    cd /d %project_service_identification_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-operation
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_operation_dir=%workspace_dir%\project\j2ee\project-service-operation
    cd /d %project_service_operation_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-order
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_order_dir=%workspace_dir%\project\j2ee\project-service-order
    cd /d %project_service_order_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-pay
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_pay_dir=%workspace_dir%\project\j2ee\project-service-pay
    cd /d %project_service_pay_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-report
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_report_dir=%workspace_dir%\project\j2ee\project-service-report
    cd /d %project_service_report_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-service-evidence
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_service_evidence_dir=%workspace_dir%\project\j2ee\project-service-evidence
    cd /d %project_service_evidence_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              处理项目project-open-platform
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    set project_open_platform_dir=%workspace_dir%\project\j2ee\project-open-platform
    cd /d %project_open_platform_dir%
    git checkout develop_spring_cloud
    git pull
    call mvn clean 
    call mvn install -Dmaven.test.skip=true
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              启动基础服务
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    start cmd /k "java -jar %workspace_dir%\project\j2eeV3\spring-boot-cloud\registry\target\registry.jar"
    ping -n 15 127.1>nul
    start cmd /k "java -jar  %workspace_dir%\project\j2eeV3\spring-boot-cloud\config\target\config.jar"
    ping -n 15 127.1>nul
    start cmd /k "java -jar  %workspace_dir%\project\j2eeV3\spring-boot-cloud\monitor\target\monitor.jar"
    ping -n 15 127.1>nul
    start cmd /k "java -jar  %workspace_dir%\project\j2eeV3\spring-boot-cloud\zipkin\target\zipkin.jar"
    ping -n 15 127.1>nul
    start cmd /k "java -jar  %workspace_dir%\project\j2eeV3\spring-boot-cloud\gateway\target\gateway.jar"
    ping -n 15 127.1>nul
    start cmd /k "java -jar  %workspace_dir%\project\j2eeV3\spring-boot-cloud\auth-service\target\auth-service.jar"
    ping -n 15 127.1>nul
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------  
    rem                              启动UCenter filling identity api open-platform
    rem -------------------------------------------------------------------  
    rem -------------------------------------------------------------------
    start cmd /k  "java -jar -Dspring.profiles.active=local %workspace_dir%\company-core\ucenter\company-service-ucenter\target\company-service-ucenter.jar"
    ping -n 15 127.1>nul
    start cmd /k  "java -jar -Dspring.profiles.active=local %workspace_dir%\project\j2ee\project-service-filing\project-service-filing\target\project-service-filing.jar"
    ping -n 15 127.1>nul
    start cmd /k  "java -jar -Dspring.profiles.active=local %workspace_dir%\project\j2ee\project-service-identification\project-service-identification\target\project-service-identification.jar"
    ping -n 15 127.1>nul
    start cmd /k  "java -jar -Dspring.profiles.active=local %workspace_dir%\project\j2ee\project-service-api\project-service-api\target\project-service-api.jar"
    ::ping -n 15 127.1>nul
    ::start cmd /k  "java -jar %workspace_dir%\project\j2ee\project-open-platform\company-web-api\target\project-web-api.war"
    pause 
  • 微服务一键关闭脚本:

     taskkill关闭进程的窗口命令。/f force  /t tree /im  image name or process name /pid process id

    @echo off
    taskkill /f /t /im cmd.exe
    pause

猜你喜欢

转载自blog.csdn.net/bjdk2009/article/details/82710006