使用winsw部署Windows服务

仓库地址: https://github.com/kohsuke/winsw
下载地址: https://github.com/kohsuke/wi...

安装说明

https://github.com/kohsuke/wi...

  1. 下载winsw程序,选择对应版本。(WinSW.NET2.exe 或 WinSW.NET4.exe)
  2. 安装.NET Framework
  3. WinSW.exe复制到自定义的目录,并重命名为test.exe
  4. 同目录下创建test.xml特别注意,xml和exe必须同名
  5. 使用test.exe install安装服务。
  6. 使用test.exe uninstall卸载服务。

示例,配置springboot的服务


  lance
  lance(winsw)
  java
  java
  -server -Xms400m -Xmx400m -Xmn100m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xverify:none -XX:+DisableExplicitGC -Djava.awt.headless=true -jar "lance-1.2.0.jar"
  

命令说明

E:\service>test.exe /?
A wrapper binary that can be used to host executables as Windows services

Usage: winsw [/redirect file]  []
       Missing arguments trigger the service mode

Available commands:
- 'install'   - install the service to Windows Service Controller
- 'uninstall' - uninstall the service
- 'start'     - start the service (must be installed before)
- 'stop'      - stop the service
- 'restart'   - restart the service
- 'restart!'  - self-restart (can be called from child processes)
- 'status'    - check the current status of the service
- 'test'      - check if the service can be started and then stopped
- 'testwait'  - starts the service and waits until a key is pressed then stops the service
- 'version'   - print the version info
- 'help'      - print the help info (aliases: -h,--help,-?,/?)

Extra options:
- '/redirect' - redirect the wrapper's STDOUT and STDERR to the specified file

WinSW 2.2.0.0
More info: https://github.com/kohsuke/winsw
Bug tracker: https://github.com/kohsuke/winsw/issues

配置说明

https://github.com/kohsuke/wi...



  

  
  
  myapp
  
  MyApp Service (powered by WinSW)
  
  This service is a service cratead from a sample configuration
  
  
  %BASE%\myExecutable.exe



  
  
  
  
  
  
  
  



  
  

  
  
  
  
  
  
  
  Normal
  
  
  15 sec
    
  
  false

  
  

  
  

    
    Automatic
    
    
    
    
    
    
    
    
    15 sec
    
    
    1 sec
    
    
    
    


  
  
  
  
  
    
  
  

  
  


  
  


  
  
  
  




你可能感兴趣的:(服务,windows)