For testing purposes I've got windows service which I'd like to restart 1s after first and 5s after second failure. Every subsequent failure within an 2min should leave service stopped. To fulfill this criteria I've tried to use "Reset fail count after" configuration but without luck. On my machine (Windows7 Enterpise x64) I've create simple service which unexpectedly close itself in 5s from start. With configuration:
sc failure FAIL1 reset= 120 actions= restart/1000/restart/5000//
I've expected that after those 2min service failure counter will be reseted and restart sequence repeated. But maybe when service is left in stopped state after second failure it will never have chance to reset counter. So I've got another service with configuration:
sc failure FAIL2 reset= 120 actions= restart/1000/restart/5000
It turns out that FAIL2 service after second failure keeps restarting in 5s and available reset counter in event log error massages is still growing.
Using third service (FAIL3) I've tried to configure simlar options using available resolution in Recovery tab of service properties:
- First failure: restart
- Second failure: restart
- Subsequent: take no action
- Reset fail count after: 1 (day)
- Restart service after: 0 (minute)
This one behaves similar to FAIL1. Executes twice and after one day stays stopped.
It looks like on my machine reseting counter timeout does not work. Maybe my imaginary configuration is not possible to achieve using this technic. Or maybe my reset counter understanding is incorrect.