public void Stop(bool removeDir) { Log(String.Format("Stopping server {0}, serverState: {1}", ServerName, ServerState)); Log(String.Format("serverScript: {0}, stopCommand: {1}", serverScript, GetStopCmd())); if (this.ServerState == GFXDState.STOPPED) { return; } ProcessStartInfo psinfo = new ProcessStartInfo(serverScript, GetStopCmd()); psinfo.UseShellExecute = true; psinfo.WindowStyle = ProcessWindowStyle.Hidden; Process proc = new Process(); proc.StartInfo = psinfo; if (!proc.Start()) { String msg = "Failed to stop elasticsql process."; Log(msg); throw new Exception(String.Format("Exception: {0}", msg)); } bool started = proc.WaitForExit(60000); if (!started) { proc.Kill(); String msg = "Timeout waiting for elasticsql process to stop."; Log(msg); throw new Exception(String.Format("Exception: {0}", msg)); } this.ServerState = GFXDState.STOPPED; if (removeDir) { RemoveServerDir(); } Log(String.Format("Server {0} stopped, serverState: {1}", ServerName, ServerState)); serverCount--; }
public GFXDServer() { LoadConfig(); if (logger != null) logger.Close(); logger = new Logger.Logger(logDir, String.Format("{0}.log", typeof(GFXDServer).FullName)); if (numServers == 1) mcastPort = 0; clientBindAddress = defaultClientBindAddress; clientPort = defaultClientPort + (serverCount++); ServerName = string.Format("{0}{1}", defaultServerDir, serverCount); serverDir = string.Format(@"{0}\{1}", installPath, ServerName); this.ServerState = GFXDState.STOPPED; }
public GFXDServer() { LoadConfig(); if (logger != null) { logger.Close(); } logger = new Logger.Logger(logDir, String.Format("{0}.log", typeof(GFXDServer).FullName)); if (numServers == 1) { mcastPort = 0; } clientBindAddress = defaultClientBindAddress; clientPort = defaultClientPort + (serverCount++); ServerName = string.Format("{0}{1}", defaultServerDir, serverCount); serverDir = string.Format(@"{0}\{1}", installPath, ServerName); this.ServerState = GFXDState.STOPPED; }
public void Start() { Log(String.Format("Starting server {0}, serverState: {1}", ServerName, ServerState)); Log(String.Format("serverScript: {0}, startCommand: {1}", serverScript, GetStartCmd())); if (this.ServerState == GFXDState.STARTED) return; ProcessStartInfo psinfo = new ProcessStartInfo(serverScript, GetStartCmd()); psinfo.UseShellExecute = true; psinfo.WindowStyle = ProcessWindowStyle.Hidden; Process proc = new Process(); proc.StartInfo = psinfo; if (!proc.Start()) { String msg = "Failed to start eslasticsql process."; Log(msg); throw new Exception(String.Format("Exception: {0}", msg)); } bool started = proc.WaitForExit(60000); if (!started) { proc.Kill(); String msg = "Timeout waiting for elasticsql process to start."; Log(msg); throw new Exception(String.Format("Exception: {0}", msg)); } this.ServerState = GFXDState.STARTED; Log(String.Format("Server {0} started, serverState: {1}", ServerName, ServerState)); }