grasp

参考:

https://www.jianshu.com/p/fc9e4ea61e13

https://blog.csdn.net/qq_28566071/article/details/80882503

spring官方推荐使用winsw来将springboot项目作为服务运行,参考https://docs.spring.io/spring-boot/docs/1.5.9.RELEASE/reference/htmlsingle/#deployment-windows

1.把java程序打包为jar包

2.下载winsw

winsw是一款可将可执行程序安装成Windows Service的开源工具,github:https://github.com/kohsuke/winsw/releases

下载文件:

需要将winsw执行程序跟xml改成同样的名字:

修改spider-1.0.xml文件内容

<configuration>
    <id>SpiderService</id> 
    <name>SpiderService</name>
    <description>This is Spider service.</description>
    <executable>java</executable> 
    <arguments>-jar spider-1.0.jar</arguments>
    <!-- 开机启动 -->
    <startmode>Automatic</startmode>
    <!-- 日志配置 -->
    <logpath>logs/service</logpath>
    <logmode>rotate</logmode>
</configuration>

配置完成后,命令行进入winsw所在的文件夹,执行“spider-1.0.exe install”,就注册服务了。

如果不再需要这个服务,使用spider-1.0.exe uninstall即可卸载服务。start启动和stop关闭服务

 

posted on 2019-01-03 15:17 xuanm 阅读(...) 评论(...) 编辑 收藏

相关文章:

  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-12-24
  • 2021-07-15
猜你喜欢
  • 2021-08-04
  • 2021-09-30
  • 2021-05-17
  • 2022-01-18
  • 2021-04-05
  • 2022-12-23
相关资源
相似解决方案