common-service.exe
在common-service.exe同级目录创建它的配置文件,注意配置文件名必须与exe程序文件名一致。目前配置文件支持两种格式,xml和yml,注意必须是.yml结尾,.yaml无法识别。 <service>
<id>common-service</id>
<name>common-service</name>
<description>软件说明.</description>
<executable>java</executable>
<arguments> -Xmx256m -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
<logmode>rotate</logmode>
</service>
id: common-service #全局唯一
name: common-service #名称
description: 软件介绍
executable: java #这里也可以指定全路径
arguments: >
-Xmx256m -Xms256m
d:/jenkins.war
--httpPort=8080
更多yml配置参考官方说明:winsw/xml-config-file.md at v3 · winsw/winsw (github.com)
接下来就是安装服务executable也可以配置Windows bat脚本(支持普通打开脚本驻留前台的脚本)
.\common-service.exe install
启动服务
net start common-service
停用服务start后面的是配置文件里面的id值
net stop common-service
卸载删除服务:
.\common-service.exe uninstall
地址:https://www.leftso.com/article/921.html