Windows【工具 04】WinSW官网使用说明及实例分享(将exe和jar注册成服务)实现服务器重启后的服务自动重启_winsw-x64

学习路线:

这个方向初期比较容易入门一些,掌握一些基本技术,拿起各种现成的工具就可以开黑了。不过,要想从脚本小子变成黑客大神,这个方向越往后,需要学习和掌握的东西就会越来越多以下是网络渗透需要学习的内容:
在这里插入图片描述

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

官方Github;官方下载地址。没有Git加速的话很难下载,分享一下发布日期为2023.01.29的当前最新稳定版v2.12.0网盘连接。
包含文件:

  • WinSW-x64.exe
  • sample-minimal.xml
  • sample-allOptions.xml

链接:https://pan.baidu.com/s/1sN3hL5HvFzzNwuz8npaQNw
提取码:vsvg

为什么要注册为服务: 服务器重启后服务可以自行重启。

WinSW官网使用说明及实例分享

1.官网使用说明

1.1 使用配置说明

Use WinSW as a global tool
  1. Take WinSW.exe or WinSW.zip from the distribution.
  2. Write myapp.xml (see the XML config file specification and samples for more details).
  3. Run winsw install myapp.xml [options] to install the service.
  4. Run winsw start myapp.xml to start the service.
  5. Run winsw status myapp.xml to see if your service is up and running.

作为全局工具使用,不同服务使用不同的xml文件进行操作。

Use WinSW as a bundled tool
  1. Take WinSW.exe or WinSW.zip from the distribution, and rename the .exe to your taste (such as myapp.exe).
  2. Write myapp.xml (see the XML config file specification and samples for more details).
  3. Place those two files side by side, because that’s how WinSW discovers its co-related configuration.
  4. Run myapp.exe install [options] to install the service.
  5. Run myapp.exe start to start the service.

作为绑定工具使用,默认使用同名的xml文件进行操作,个人感觉这种方式更适合实施的小伙伴儿。

Sample configuration file

You write the configuration file that defines your service. The example below is a primitive example being used in the Jenkins project:

<service>
  <id>jenkins</id>
  <name>Jenkins</name>
  <description>This service runs Jenkins continuous integration system.</description>
  <env name="JENKINS\_HOME" value="%BASE%"/>
  <executable>java</executable>
  <arguments>-Xrs -Xmx256m -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
  <log mode="roll"></log>
</service>

The full specification of the configuration file is available here. You can find more samples here.
这个配置文件举例是很典型的可执行文件+参数,适合很多服务。

1.2 Usage

WinSW is being managed by the XML configuration file.
Your renamed WinSW.exe binary also accepts the following commands:

CommandDescription
installInstalls the service.
uninstallUninstalls the service.
startStarts the service.
stopStops the service.
restartStops and then starts the service.
statusChecks the status of the service.
refreshRefreshes the service properties without reinstallation.
customizeCustomizes the wrapper executable.
devExperimental commands.

Experimental commands:

CommandDescription
dev psDraws the process tree associated with the service.
dev killTerminates the service if it has stopped responding.
dev listLists services managed by the current executable.

Most commands require Administrator privileges to execute. WinSW will prompt for UAC in non-elevated sessions.
这些命令不再详细说明,用到的时候再介绍。

2.实例分享

2.1 将exe注册成服务

这里使用对象存储MinIO的minio.exe进行Use WinSW as a bundled tool举例,详细步骤如下:

  1. WinSW-x64.exe重命名为minio-server.ext
  2. 添加配置文件minio-server.xim内容如下,配置详情可查看sample-allOptions.xml
<service>
  <id>minio-server</id>
  <name>MinIO-Server</name>
  <description>This service runs MINIO OBJECT STORE.</description>
  <env name="MINIO\_HOME" value="%BASE%"/>
  <executable>%BASE%\minio.exe</executable>
  <arguments>server D:\minio_data --console-address ":9001"</arguments>
  <logpath>%BASE%\logs</logpath>


**先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7**

**深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!**

**因此收集整理了一份《2024年最新网络安全全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。**
![img](https://img-blog.csdnimg.cn/img_convert/1eeb6d70b75c0f1e85a495c556295130.png)
![img](https://img-blog.csdnimg.cn/img_convert/e6ada2337f93ad2d59b19e1e00acec09.png)
![img](https://img-blog.csdnimg.cn/img_convert/8eb90092ac96aa3650a549870c955322.png)
![img](https://img-blog.csdnimg.cn/img_convert/3bb6a692dc99f8da99dae137114e0f46.png)
![img](https://img-blog.csdnimg.cn/img_convert/08dd5280fac13dca1436d7031bbea58d.png)
![img](https://img-blog.csdnimg.cn/img_convert/dd6a49f3c6ed808612ffe05697f428b8.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上网络安全知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以点击这里获取](https://bbs.csdn.net/topics/618540462)**

础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上网络安全知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化资料的朋友,可以点击这里获取](https://bbs.csdn.net/topics/618540462)**

  • 23
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值