章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • linux

  • windows

    • windows支持多用户远程登录
    • windows应用服务部署脚本
      • linux 使用ssh免密连接Windows 10
      • windows彻底删除顽固文件的代码
      • Win11关闭Windows Defender实时保护
      • win10 神州网信开启远程
      • windows打开软件白屏或黑屏
    • 中间件

    • 网络

    • 安全

    • 存储

    • 防火墙

    • 数据库

    • 系统

    • docker

    • other

    • 监控

    • 运维
    • windows
    章工运维
    2023-02-28
    目录

    windows应用服务部署脚本

    �����������������������������������������������������������������������������������������������������������������������������������������������������

    # 杀掉服务脚本

    @echo off
    set TempFile=%TEMP%\sthUnique.tmp
    wmic process where name="md.exe" get processid,commandline | find "gf" >%TempFile%
    set /P _string=<%TempFile%
    set _pid=%_string:~32%
    echo %_pid%
    taskkill /f /pid %_pid%
    
    1
    2
    3
    4
    5
    6
    7

    # 服务启动配置

    打开任务计划程序,创建任务

    # ansible部署脚本

    ---
    - hosts: "windows_deploy02"
      tasks:
        - name: kill md service
          win_command: c:\\app\md.bat
          ignore_errors: True
          tags:
            - taskkill_md
        # - name: kill md service
        #   win_command: taskkill /F /im md.exe
        #   ignore_errors: True
        #   tags:
        #     - taskkill_md  
        - name: copy gf file
          win_copy:
            src: "{{ WORKSPACE }}/Quote_md/"
            dest: c:\\app\gf\Quote_md\
          tags:
            - copy_gf
        - name: copy gf config file
          win_copy:
            src: "/var/jenkins_home/project_config/gf_md/source_md.yaml"
            dest: c:\\app\gf\Quote_md\etc
          tags:
            - copy_gf_config
        - name: copy quote file
          win_copy:
            src: "{{ WORKSPACE }}/Quote_md/"
            dest: c:\\app\quote\md\
          tags:
            - copy_quote
        - name: copy quote config file
          win_copy:
            src: "/var/jenkins_home/project_config/airm_md/source_md.yaml"
            dest: c:\\app\quote\md\etc
          tags:
            - copy_quote_config
        - name: start trade service
          win_command: C:\Windows\System32\schtasks.exe /Run /TN start_gf
          tags:
            - start_gf
          ignore_errors: True
        - name: start quote service
          win_command: C:\Windows\System32\schtasks.exe /Run /TN start_quote
          ignore_errors: True
          tags:
            - start_quote
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47

    # hosts文件

    [windows_deploy02]
    172.16.30.198 ansible_ssh_port=5985 ansible_ssh_user=admin ansible_ssh_pass=123456 ansible_connection=winrm ansible_winrm_server_cert_validation=ignore ansible_winrm_transport=ssl
    
    1
    2

    # jenkinsfile文件

    
    
    1
    微信 支付宝
    上次更新: 2023/04/21, 08:57:47

    ← windows支持多用户远程登录 linux 使用ssh免密连接Windows 10→

    最近更新
    01
    shell脚本模块集合
    05-13
    02
    生活小技巧(认知版)
    04-29
    03
    生活小技巧(防骗版)
    04-29
    更多文章>
    Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式