If you are familiar with C# you could try using a background worker to monitor the process and restart it when you get problems.
E.g. something similar I have (for a GUI app) looks like the below
private void startServer()
{
if (this.CancellationPending == true)
{
Console.WriteLine("Termination of {0} requested", thisServer.serverSettings.serverName);
this.ReportProgress(100);
this.Dispose(true);
}
else
{
try
{
thisServer.serverStatus = status.Starting;
using (Process p = Process.Start(thisServer.serverStartInfo))
{
thisServer.serverProc = p;
p.WaitForInputIdle(thisServer.serverSettings.startupDuration.Milliseconds);
thisServer.serverStatus = status.Running;
while (p.Responding)
{
// happy days
}
thisServer.serverStatus = status.Unknown;
try
{
p.Close();
thisServer.serverStatus = status.Offline;
}
catch
{
try
{
p.Kill();
thisServer.serverStatus = status.Offline;
}
catch { }
}
}
reRun();
}
catch
{
thisServer.serverStatus = status.Offline;
ReportProgress(100, "Error encountered when attempting to launch executable. Please review server settings.");
}
}
}
I need something standalone. Not self developed. But it might work. I have my reasons. – Ahmed Al Hafoudh – 2011-11-04T21:18:02.917