如何使用"sc"安装服务并为“后续失败"指定“不采取任何措施"恢复中 [英] How to use "sc" to install a service and specify NO ACTION for "subsequent failures" under recovery

查看:123
本文介绍了如何使用"sc"安装服务并为“后续失败"指定“不采取任何措施"恢复中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB.NET中创建了一个服务,并希望使用"sc"程序进行安装. (我需要打包它,以便组织中的其他人可以执行实际安装.)

I created a service in VB.NET and wanted to use the "sc" program to install it. (I needed to package it so that someone else in my organization could perform the actual install.)

我希望恢复"选项如下所示:

I wanted the "Recovery" options to look as follows:

  • 首次失败:重新启动
  • 第二次失败:重新启动
  • 后续失败:无能为力

这是我最初尝试的命令(在实际安装后):

This is the command I initially attempted (after the actual install):

sc failure MyServiceName reset= 86400 actions= restart/15000/restart/30000

但是随后在GUI中查看该服务,后续失败"也被设置为重新启动.我看着SO,找不到任何具体的东西.我最终弄清楚了,如果有人正在寻找与我相同的快速"答案,我将在此处发布.当然,如果任何人有任何贡献,我都希望阅读.

But then looking at the service in the GUI, "Subsequent Failures" was also set to restart. I looked on SO and couldn't find anything specific. I eventually figured it out, and I am posting this here in case anyone else is looking for the same "quick" answer I was. And of course, if anyone has anything to contribute, I would love to read it.

推荐答案

我最终想出了这样的命令:

I eventually figured out to run the command like this:

sc failure MyServiceName reset= 86400 actions= restart/15000/restart/30000//1000

一旦执行完此操作,然后重新打开服务属性GUI,就会显示不执行任何操作".

Once I did this, and re-openned the service properties GUI, "Take no action" was shown as I wanted it to be.

开始写问题之后,我终于找到了这个问题: https://stackoverflow.com/a/12631379/1812688

After I started writing the question, I did finally find this SO question: https://stackoverflow.com/a/12631379/1812688

尽管不是直接回答这个问题

Although, it wasn't in direct response to the question

这篇关于如何使用"sc"安装服务并为“后续失败"指定“不采取任何措施"恢复中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆