Hi,
I'm trying to make a console app that would monitor some process and restart it if it exits. So, the console app is always on, it's only job is to restart some other process.
I posted my code below.. it basically works but just for one process restart...
I would appreciate any help!!
Thanks in advance!
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName(SOME_PROCESS);
p[0].Exited += new EventHandler(Startup_Exited);
while (!p[0].HasExited)
{
p[0].WaitForExit();
}
//Application.Run();
}
private static void Startup_Exited(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(AGAIN_THAT_SAME_PROCESS);
}