简体   繁体   English

Windows服务监视本地系统时间以启动其他服务?

[英]a windows service monitors local system time to start other services?

need your advices on this scenario: I have a bunch of services installed on a server, they need to be set to start and stop dynamically depending on the local system time, meaning the start time and end time are different almost everyday, eg, today these services are set to start by 9am and end by 9pm, and tomorrow could be 10:30 am and 9pm. 在这种情况下需要您的建议:我在服务器上安装了一堆服务,需要将它们设置为根据本地系统时间动态启动和停止,这意味着开始时间和结束时间几乎每天都不同,例如今天这些服务的开始时间是上午9点到晚上9点,明天可能是上午10:30和晚上9点。

starttime and endtime are stored in an xml file that is generated on daily basis 开始时间和结束时间存储在每天生成的xml文件中

So, I'm thinking about using another service to read the xml file and triggers the services accordingly, but it needs to be real time so it always monitors the local system time. 因此,我正在考虑使用另一个服务来读取xml文件并相应地触发服务,但是它必须是实时的,因此它始终监视本地系统时间。

If this is possible how exactly I should do to achieve this programatically? 如果可能的话,我应该怎么做才能以编程方式实现这一目标?

I would create a script that can stop and start every service pair those with scheduled tasks. 我将创建一个脚本,该脚本可以停止和启动具有计划任务的每个服务对。 then you can programmaticaly modify the scheduled remotely even if needed. 那么您可以通过编程方式远程修改计划的计划,即使需要也可以。 Creating your own service will be error prone. 创建自己的服务很容易出错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM