Chef push jobs to restart a windows service on a node

Hi,
I want to use chef push jobs to restart a windows service on the windows node managed by chef sever.
This is what I did.
I created stop_svc and start_svc cookbooks with the following content, respectively:

service ‘w3svc’ do
action [:enable, :start]
end

service ‘w3svc’ do
action [:enable, :stop]
end

I added stop_svc and start_svc cookbooks to the run list for the node. I also added stop_svc and start_svc
in the white list as below:

default[‘push_jobs’][‘whitelist’] = {
‘chef-client’ => ‘chef-client’,
‘stop_iis’ => ‘chef-client -o recipe[stop_iis]’,
‘start_iis’ => ‘chef-client -o recipe[start_iis]’
}

I can then use “knife job start ‘stop_svc’ ‘node1’” and “knife job start ‘start_svc’ ‘node1’” to stop and start the service on the node.

However, the problem here is that since I have added stop_svc and start_svc cookbooks to the run list for the node, everytime the chef-client run occurs on the node every 30 minutes, it will execute these two cookbooks and I dont’ want the service to stop and start every 30 minutes.

Is there a way for me to start and stop service through push jobs without having to rely on cookbooks and run list?

Can service or windows_service resource be used directly in the whitelist to initiate push jobs? For example I tried below and it does not work.

default[‘push_jobs’][‘whitelist’] = {
‘chef-client’ => ‘chef-client’,
‘iis_restart’ => ‘service w3svc restart’
}

How would you stop and start service on a node with push jobs?

thanks in advance

I realize that in case the two cookbooks don’t change, they won’t be executed during the chef-client run on the node every 30 minutes. However, in case they do change somehow, they will get executed and i do not want the risk of the service restarting during the chef client run.

Please advise of a way to restart a service with push jobs outside of having to rely on cookbooks and run list.

thanks.