Batch file runs a process which hangs - how to restart automatically?
Posted on 2009-07-09
I have a batch file that starts a VB script every day, it downloads reports and puts them onto a series of 'reportable' files and then sends them out.
Occasionally it gets stuck so I have to wait for an hour and then kill it manually and then restart. This one should be do-able as it runs as a service account, so all running processes by that user account can be killed but I don't know how to do this. I'd want it to
Ideally what it would do is query all processes (12 including cmd windows and java.exe) every few minutes and if no CPU was being used them terminate and start again.
The process also occasionally creates a .LCK file which would need to be removed as well for the process to restart. Any ideas?