Service packaging software nssm

Introduction

nssm is a service encapsulation program, which can encapsulate ordinary exe programs into services and make them run like windows services. Microsoft's own srvany is the same type of tool, but nssm is easier to use and powerful.

Its characteristics are as follows:

  • Support ordinary exe program (console program or Windows program with interface are both possible)
  • Easy to install and easy to modify
  • Can redirect output (and supports Rotation)
  • The packaged service can be automatically guarded, and the program can be automatically restarted after the program hangs.
  • You can customize environment variables

download

download link

installation

After the download is complete, select the 32-bit or 64-bit nssm.exe according to the number of bits of the operating system.

The following takes the installation of Snipaste as an example to show the installation process.

  1. Open cmd with administrator privileges, enter the directory where nssm.exe is located, run the command nssm install Snipaste, and the following interface will pop up:

Insert picture description here

  1. PathIt is the name of the running program with path; it Startup diretoryis the running path, that is, the directory where the running program is located; Argumentsit is the startup parameter of the program; click after filling in Install Service, the execution is successful, and the prompt is as follows:

Insert picture description here

  1. At this time, just set the program as a service, and the service is still closed . To start the service, run the command: nssm start SnipasteOK. If the command fails to start the service , you can run the command directly services.mscand open the service interface to manually start the Snipaste service.

Command summary

nssm start servername //启动服务
nssm stop servername //暂停服务
nssm restart servername //重新启动服务
nssm remove servername //删除创建的servername服务

reference

Windows uses NSSM to encapsulate any exe as a service
NSSM-the Non-Sucking Service Manager

Guess you like

Origin blog.csdn.net/xp178171640/article/details/112266415