失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > winsw将命令部署为服务(比如springboot)

winsw将命令部署为服务(比如springboot)

时间:2023-04-29 13:46:53

相关推荐

winsw将命令部署为服务(比如springboot)

工具

/winsw/winsw/releases

下载.netcore的exe就行,比如

/winsw/winsw/releases/download/v2.9.0/Core31.x64.exe

PS:我为什么不下载net2那些版本,那些版本一看大小就是需要本地.netframework环境依赖的,我嫌装着麻烦,这个netcore31应该是包含了netcore运行环境的,不需要额外安装.netframework,所以我就用了这个。

下载下来,改名为

myservice.exe

配置

创建myservice.xml,主要是跟exe同名,添加内容

<service><!-- ID of the service. It should be unique across the Windows system--><id>myapp</id><!-- Display name of the service --><name>myapp</name><!-- Service description --><description></description><!-- Path to the executable, which should be started --><executable>%BASE%\start.bat</executable></service>

启动服务的命令写到start.bat里就好了

start.bat比如

@echo offcd %~dp0java -Dspring.profiles.active=prd -jar myapp.jar

注册服务

myservice install

服务中就有一个myapp服务了

注销服务

myservice uninstall

启停服务

net start myapp

net stop myapp

如果觉得《winsw将命令部署为服务(比如springboot)》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。