[英]Restart srvany when child process gets killed
I've created a service, which is a plain console application running via srvany.exe
. 我已经创建了一个服务,它是一个通过srvany.exe
运行的普通控制台应用程序。 It was set up to immediately restart when destroyed. 它被设置为在销毁时立即重启。 Here's the script: 这是脚本:
sc delete "Test Service"
sc create "Test Service" binpath= "C:\Windows\System32\srvany.exe" start= auto
sc failure "Test Service" reset= 86400 actions= restart/0
sc description "Test Service" Blah
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Test Service\Parameters" /v Application /d "C:\<path>\testserv.exe"
sc start "Test Service"
It's created properly, and restarts if I kill srvany
with taskmgr
. 它已正确创建,如果我使用taskmgr
杀死srvany
,则重新启动。 But when I kill testserv
, srvany
keeps running, effectively ruining my plans for immediate restart. 但是当我杀死testserv
, srvany
继续运行,有效地破坏了我立即重启的计划。
Is there a (either console or registry) key for srvany
to exit when its child process gets killed? srvany
是否有(控制台或注册表)密钥在其子进程被杀死时退出? If not, is there any other simple ways to accomplish this task (without writing a service )? 如果没有,有没有其他简单的方法来完成这项任务(没有编写服务 )?
While srvany will gladly start your application as a service, it does not monitor the spawned process in any way to achieve what you want. 虽然srvany很乐意将您的应用程序作为服务启动,但它不会以任何方式监视生成的进程以实现您想要的目标。 We have a competing software called AlwaysUp; 我们有一个名为AlwaysUp的竞争软件; read more about srvany's shortcomings there. 阅读更多关于srvany在那里的缺点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.