patd1
asked on
kill child process on restart of my windows service
I have created a windows service which fires another process (myprocess.exe) every 10 minutes, which creates files, prints them and exits. Sometimes when someone restarts the service while myprocess is still running, it does not kill the myprocess in the memory. The service starts another myprocess.exe, and now I see two instances of myprocess.exe in the task manager. Since both are trying to write to the same file, they clash and I get error.
How do I make my service kill myprocess.exe, if it is running when the service gets restarted.
Thanks.
How do I make my service kill myprocess.exe, if it is running when the service gets restarted.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It doesn't matter, but make sure you kill the process before you start the new process.
ASKER
Thank You.