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
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
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
2
# jenkinsfile文件
1
上次更新: 2023/04/21, 08:57:47