winsw将命令部署为服务(比如springboot)
生活随笔
收集整理的這篇文章主要介紹了
winsw将命令部署为服务(比如springboot)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
工具
https://github.com/winsw/winsw/releases
下載.netcore的exe就行,比如
https://github.com/winsw/winsw/releases/download/v2.9.0/WinSW.NETCore31.x64.exe
PS:我為什么不下載net2那些版本,那些版本一看大小就是需要本地.netframework環(huán)境依賴的,我嫌裝著麻煩,這個(gè)netcore31應(yīng)該是包含了netcore運(yùn)行環(huán)境的,不需要額外安裝.netframework,所以我就用了這個(gè)。
下載下來(lái),改名為
myservice.exe
配置
創(chuàng)建myservice.xml,主要是跟exe同名,添加內(nèi)容
<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>啟動(dòng)服務(wù)的命令寫(xiě)到start.bat里就好了
start.bat比如
注冊(cè)服務(wù)
myservice install
服務(wù)中就有一個(gè)myapp服務(wù)了
注銷服務(wù)
myservice uninstall
啟停服務(wù)
net start myapp
net stop myapp
總結(jié)
以上是生活随笔為你收集整理的winsw将命令部署为服务(比如springboot)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: devcon教程
- 下一篇: web前端简历的详解