How to set up dependencies between windows-services on different servers in same domain

前端 未结 1 1232
别跟我提以往
别跟我提以往 2020-12-21 11:26

I have a situation where a windows service on one server should not be started until a windows service on a different server has started. What I\'d like to do is set the ser

相关标签:
1条回答
  • 2020-12-21 11:49

    Dependencies between Windows Services on the same machine are managed by the Service Control Manager (SCM). The SCM can't/won't help you if your service is dependent on a Service on a different machine.

    Therefore you will have to get some code of your own running in order to monitor in some fashion whether the remote service is running or not, and to get that code running you'll have to allow your service to start with or without the dependency.

    It's difficult to prescribe a detailed solution without knowing the purpose of your service, but in principle you probably need your service to have two modes of operation: one where it does nothing except monitor in some fashion whether the remote service on which it depends is running; and the another where it performs its full functionality as well as continuing to monitor the dependency.

    This last point is crucial - you will in any case have to monitor the dependency continuously, not just around the time your service is starting, because unlike the single machine situation, the SCM on the remote machine will not prevent the remote service being stopped, as it knows nothing about your dependency on it.

    0 讨论(0)
提交回复
热议问题