电竞比分网-中国电竞赛事及体育赛事平台

分享

Scheduling starting a service after another service.

 迎風(fēng)初開 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.



    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多