1 Star 1 Fork 0

CHQ7 / winsw

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
self-restarting-service.md 994 Bytes
一键复制 编辑 原始数据 按行查看 历史
Next Turn 提交于 2020-08-11 07:54 . Revise docs for 3.0.0-alpha.3 (#608)

Self-restarting Windows services

Restart from the spawned process

To support self-restarting services, winsw exposes WINSW_EXECUTABLE environment variable into the forked process, which refers to the full path of WinSW.exe that's managing the service. To restart the service from within, execute %WINSW_EXECUTABLE% restart!. Note that you are invoking restart! command, not restart command. This hidden command is a flavor of the restart operation, where winsw creates another winsw process in a separate process group, and restarts the service from there.

This additional indirection is necessary because WinSW will kill child processes recursively when it stops a service. Windows Service Control Manager (SCM) doesn't provide the restart operation as an atomic operation either, so winsw implements restart by a sequence of stop and start. The second winsw process in a separate process group ensures that winsw can survive this massacre to execute the start call.

1
https://gitee.com/umb/winsw.git
git@gitee.com:umb/winsw.git
umb
winsw
winsw
v3

搜索帮助