Windows下使用winsw自定义自启动服务

windows上没有nohup run.sh & 一直开启cmd窗口,实在不方便,所以找到了WinSW工具

下载

下载地址


选择如下两个文件下载

配置

下载完成后,放在同一文件夹下,重命名为相同的名字,如下
编辑xml文件如下

<service>
  
  <!-- ID of the service. It should be unique across the Windows system-->
  <id>elasticsearch7</id>
  <!-- Display name of the service -->
  <name>elasticsearch7</name>
  <!-- Service description -->
  <description>This service is a service created from a minimal configuration</description>
  
  <!-- Path to the executable, which should be started -->
  <executable>D:\MyProgram\development\elk\elasticsearch-7.7.1\bin\elasticsearch.bat</executable>
  
   <!-- <arguments>-jar statement-0.0.1-SNAPSHOT.jar</arguments> -->

</service>
### 注册服务

当前文件夹下以管理员身份打开cmd,运行boot.exe install

启动服务并运行

提示成功后services.msc 打开服务列表,启动对用的服务,并设置为自启动即可

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。