前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >springboot jar注册成windows服务

springboot jar注册成windows服务

作者头像
山行AI
发布2019-11-07 16:03:05
1.6K0
发布2019-11-07 16:03:05
举报
文章被收录于专栏:山行AI山行AI

安装步骤

winsw(https://github.com/kohsuke/winsw/releases),winsw 是一个可以将任何应用程序注册成服务的软件。

下载 winsw

  • 地址:https://github.com/kohsuke/winsw/releases
  • 下载的内容:

重命名

将打出的 TMarket.jar 与 winsw.exe 放在同一个目录中,然后将 winsw.exe 重命名为 TMarket.exe

创建配置

创建 TMarket.xml 如下(具体参数参考:https://github.com/kohsuke/winsw):

代码语言:javascript
复制
<service>
 <id>TMarket</id>
 <name>TMarket-serv</name>
 <description>TMarket server for calendar and news message!</description>
 <executable>java</executable>
 <arguments>-Xmx512m -Xms512m -jar "TMarket.jar"</arguments>
<startmode>Automatic</startmode>
 <logpath>logs</logpath>
 <logmode>rotate</logmode>
</service>

安装服务与卸载服务

  • 安装: TMarket.exe install
  • 卸载: TMarket.exe uninstall 或 sc delete TMarket

启动方式

  • 方式一: net start TMarket(服务 id)
  • 方式二: TMarket.exe start

关闭方式

  • 方式一: cmd 中通过 services.msc 进入服务列表操作
  • 方式二: 任务管理器中操作
  • 方式三: net stop TMarket
  • 方式四: TMarket.exe stop

查找服务

代码语言:javascript
复制
SC queryex TMarket

winsw的其他命令

  • install to install the service to Windows Service Controller. This command requires some preliminary steps described in the Installation Guide.
  • uninstall to uninstall the service. The opposite operation of above.
  • start to start the service. The service must have already been installed.
  • stop to stop the service.
  • restart to restart the service. If the service is not currently running, this command acts like start.
  • status to check the current status of the service.This command prints one line to the console.
  • NonExistent indicates the service is not currently installed
  • Started to indicate the service is currently running
  • Stopped to indicate that the service is installed but not currently running.

参考

  • https://github.com/kohsuke/winsw
  • https://blog.csdn.net/weixin_40411331/article/details/80193376
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-10-31,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 开发架构二三事 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装步骤
    • 下载 winsw
      • 重命名
        • 创建配置
          • 安装服务与卸载服务
            • 启动方式
              • 关闭方式
                • 查找服务
                  • winsw的其他命令
                  • 参考
                  领券
                  问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档