Example #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // TODO: Implement Functionality Here

//            TmxHelper.NewTestSuite("name", "id", null, null, null, null);
//
//
//            TmxHelper.AddTestScenario(
//                new AddScenarioCmdletBase {
//                // new AddTmxTestScenarioCommand {
//                    Name = "name 2",
//                    Id = "id 2",
//                    TestPlatformId = null,
//                    TestSuiteId = null,
//                    Description = null
//                });

            // Tmx.Server.ServerControl.Start(@"http://localhost:12340");
            ServerControl.Start("localhost", 12340);

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
Example #2
0
        public void Start()
        {
            Logger.Info(@"Scene server starting...");

            PathManager.Start();
            SceneManager.Instance.Init();
            //TestFight.Test();
            ServerControl.Start(mPort, mAuth, Logger);
        }
Example #3
0
        public static void Main(string[] args)
        {
            try {
                ServerControl.Port = 12340;
                ServerControl.Start(@"http://*****:*****@"Press any key to stop server . . . ");
            Console.ReadKey(true);
            ServerControl.Stop();

            /*
             * try
             * {
             *  ServerControl.Start(TestSettings.BaseUrl);
             *
             *  if (!Environment.UserInteractive)
             *  {
             *      var services = new ServiceBase[] { new ServiceControl() };
             *      ServiceBase.Run(services);
             *  }
             *  else
             *  {
             *      var service = new ServiceControl();
             *      Thread.Sleep(Timeout.Infinite);
             *  }
             * }
             * catch (Exception ex)
             * {
             *  Console.WriteLine(ex.Message);
             *  Console.WriteLine(ex.StackTrace);
             *  // Console.WriteLine(ex.InnerException.Message);
             * }
             * Console.Write("Press any key to stop server . . . ");
             * Console.ReadKey(true);
             * ServerControl.Stop();
             */
        }
Example #4
0
        internal override void Execute()
        {
            var cmdlet = (StartTmxServerCommand)Cmdlet;

            try {
                ServerControl.Port = cmdlet.Port;
                ServerControl.Start(@"http://localhost:" + cmdlet.Port);
            }
            catch (Exception eStartingServer) {
                Console.WriteLine(eStartingServer.Message);
                Console.WriteLine(eStartingServer.InnerException.Message);
            }
//            var hostname = Dns.GetHostName();
//            if (string.Empty != IPGlobalProperties.GetIPGlobalProperties().DomainName) {
//                hostname += ".";
//                hostname += IPGlobalProperties.GetIPGlobalProperties().DomainName;
//            }
//            Tmx.Server.ServerControl.Start(hostname, cmdlet.Port);

            // Tmx.Server.ServerControl.Start(cmdlet.Hostname, cmdlet.Port);
        }
Example #5
0
        public void Start()
        {
            Logger.Info(@"Rank server starting...");

            ServerControl.Start(mPort, mAuth, Logger);
        }
Example #6
0
        private void _Start()
        {
            if (Settings.Current[Constants.RUNNING_USERNAME_SETTING_NAME] == null)
            {
                Settings.Current[Constants.RUNNING_USERNAME_SETTING_NAME] = "www";
            }
            pidfile         = null;
            consoleMessages = false;
            if (args.Length > 0)
            {
                for (int x = 0; x < args.Length; x++)
                {
                    switch (args[x])
                    {
                    case "--runningUser":
                        Settings.Current[Constants.RUNNING_USERNAME_SETTING_NAME] = args[x + 1];
                        x += 1;
                        break;

                    case "--pidfile":
                        pidfile = args[x + 1];
                        x      += 1;
                        break;

                    case "--showConsoleMessages":
                        consoleMessages = true;
                        break;

                    case "--showRunningThreads":
                        _runningThreads          = new List <NameValuePair>();
                        _runningThreadsOutputter = new Timer(new TimerCallback(_OutputRunningThreads), null, 30000, 30000);
                        break;

                    case "--showPerformanceData":
                        perfomanceMessages = true;
                        if (!ModuleController.Current.IsModuleEnabled("SystemMonitoring"))
                        {
                            ModuleController.Current.EnableModule("SystemMonitoring");
                        }
                        EventController.RegisterEventHandler(this);
                        break;

                    default:
                        Console.WriteLine("Invalid command line arguements specified " + args[x] + ", ignoring.");
                        break;
                    }
                }
            }
            if (Utility.OperatingSystem == null)
            {
                Console.WriteLine("Unknown operating system, exiting...");
                _shutdownEvent.Set();
                return;
            }
            if (consoleMessages)
            {
                ConfigSite.TurnOnConsoleLogging();
            }
            foreach (FileInfo fi in new DirectoryInfo(basePath).GetFiles("*.dll"))
            {
                if (consoleMessages)
                {
                    Console.WriteLine("Loading assembly from dll " + fi.Name + " ...");
                }
                Assembly.LoadFile(fi.FullName);
                if (consoleMessages)
                {
                    Console.WriteLine("Loaded assembly from dll " + fi.Name + ".");
                }
            }
            if (consoleMessages)
            {
                Console.WriteLine("Loaded assemblies: ");
                foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
                {
                    try
                    {
                        if (ass.GetName().Name != "mscorlib" && !ass.GetName().Name.StartsWith("System.") && ass.GetName().Name != "System" && !ass.GetName().Name.StartsWith("Microsoft"))
                        {
                            Console.WriteLine(ass.GetName().FullName);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.LogError(e);
                    }
                }
            }
            if (ProcessSecurityControl.Current.CurrentProcessUserID != ProcessSecurityControl.Current.GetUIDForUser("root"))
            {
                Console.WriteLine("You must run this application as the root user, it will secure itself afterwards.");
                _shutdownEvent.Set();
                return;
            }
            else
            {
                if (consoleMessages)
                {
                    Console.WriteLine("Starting up control socket...");
                }
                if (consoleMessages)
                {
                    Console.WriteLine("Control Socket started.");
                }
                if (consoleMessages)
                {
                    Console.WriteLine("Starting up Website through Server Control...");
                }
                ServerControl.Start();
                if (_runningThreads != null)
                {
                    ServerControl.RegisterBackgroundOperationPreCall(_preCall);
                    ServerControl.RegisterBackgrounOperationPostCall(_postCall);
                }
                if (consoleMessages)
                {
                    Console.WriteLine("Website started with Server Control.");
                }
                try
                {
                    if (consoleMessages)
                    {
                        Console.WriteLine("Closing up Process security...");
                    }
                    ProcessSecurityControl.Current.CloseProcessSecurity();
                    if (consoleMessages)
                    {
                        Console.WriteLine("Process Security Closed.");
                    }
                }
                catch (Exception e)
                {
                    Logger.LogError(e);
                    Console.WriteLine("WARNING!!! An error occured changing the security role of the current process away from root.  It is still running as the root user.");
                }
                if (pidfile != null)
                {
                    if (consoleMessages)
                    {
                        Console.WriteLine("Writing process ID to pidile " + pidfile + "...");
                    }
                    SetPidFile(pidfile);
                    if (consoleMessages)
                    {
                        Console.WriteLine("Process ID written to file.");
                    }
                }
            }
            _internalShutdownEvent.WaitOne();
            OnStop();
        }