Windows and interval runs


#1

As part of researching how to implement the multi-policy RFC, I’ve been trying to untangle how we implement chef-client -i on Windows. As best I can tell, it’s running all interval runs in a single process? I’m surprised we haven’t noticed that breaking more things since the whole reason we disabled non-fork interval runs was a parade of annoying bugs. Am I reading all this correctly? Notably the docstring on run_with_graceful_exit_option seems entirely wrong in the context of Windows.


#2

There are really two ways that Windows users run chef-client at interval: using a windows service or a windows scheduled task. Both, by their very nature run in a separate process and neither involve calling chef-client with -i.

The windows service is typically installed using bin/chef-service-manager and it usesChef::Config[:interval]` to control how often the service runs.

The scheduled task is typically setup via schtasks.exe or the more modern powershell cmdlets and the task itself is given a frequency type and frequency modifier to control the interval.

There are recipes in the chef-client cookbook to setup either means of running chef at regular intervals on windows.