Ejemplo n.º 1
0
        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--;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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));
        }