Use a PID lock file instead of making the wait executable go by the process name to allow for multiple bots on a single machine

This commit is contained in:
Zontreck 2020-08-31 23:12:25 -07:00
parent 4882732b7f
commit f015c79b75
2 changed files with 4 additions and 2 deletions

View file

@ -46,6 +46,7 @@ namespace Bot
public static unsafe void Main(string[] args)
{
File.WriteAllText("PID.lock", Process.GetCurrentProcess().Id.ToString());
Console.WriteLine("Setting up Main Configuration");
Log = new Logger("BotCore5");
BotSession.Instance.Logger = Log;
@ -497,6 +498,7 @@ namespace Bot
AutoResetEvent are = new AutoResetEvent(false);
are.WaitOne(TimeSpan.FromMinutes(5));
}
File.Delete("PID.lock");
Environment.Exit(0);
//System.Console.WriteLine("PAUSING. PRESS ANY KEY TO EXIT");