分享

Scheduling starting a service after another service.

 迎风初开 2011-06-22

In my experience, the best way to create service dependencies, without rummaging in the registry (something that is not secure, safe, or easily scriptable == repeatable) is to use SC.exe - the service control utility packaged with every Windows version since Win2003.

You can open a command window and type sc to get the full help, but the gist of it is:

sc create newservice binpath= c:\nt\system32\newserv.exe type= own start= auto depend ="netbios"


/////////////

You have to use the registry editor (as far as I know) to make the service depend on the other server. Locate the dependent service in HKLM\SYSTEM\CurrentControlSet\services, and add an REG_MULTI_SZ value called DependOnService. Put the service name (not the display name, but the same name as it's reg key) as a value.

When you reboot now, Windows will only start your dependent service after the service you made it depend on starts. Likewise, if the service it depends on fails to start, your dependent service will not start either.



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多