From 5ba3fa962987b5e73757f2022964104748c38e19 Mon Sep 17 00:00:00 2001 From: gareth Date: Mon, 14 May 2007 01:50:13 +0000 Subject: [PATCH] Added -setuponly switch to gridserver KILLED THE GRIDSERVER'S CONSOLE VICIOUSLY AND WITHOUT MERCY!!!! Added gridserver setup to InitSetup() in ServiceManager --- OpenGridServices.GridServer/Main.cs | 13 ++++++++----- ServiceManager/ServiceManager.cs | 10 ++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs index f7b0067c05..1a2a0fbbd0 100644 --- a/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices.GridServer/Main.cs @@ -32,6 +32,7 @@ using System.IO; using System.Text; using System.Timers; using System.Net; +using System.Threading; using System.Reflection; using libsecondlife; using OpenSim.Framework; @@ -51,6 +52,7 @@ namespace OpenGridServices.GridServer public GridConfig Cfg; public static OpenGrid_Main thegrid; + public static bool setuponly; //public LLUUID highestUUID; @@ -63,7 +65,8 @@ namespace OpenGridServices.GridServer [STAThread] public static void Main(string[] args) { - Console.WriteLine("Starting...\n"); + if(args[0]=="-setuponly") setuponly=true; + Console.WriteLine("Starting...\n"); thegrid = new OpenGrid_Main(); thegrid.Startup(); @@ -73,11 +76,10 @@ namespace OpenGridServices.GridServer private void Work() { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"\nEnter help for a list of commands\n"); - while (true) { - m_console.MainConsolePrompt(); + Thread.Sleep(5000); + // should flush the DB etc here } } @@ -94,6 +96,7 @@ namespace OpenGridServices.GridServer m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); Cfg = this.LoadConfigDll(this.ConfigDll); Cfg.InitConfig(); + if(setuponly) Environment.Exit(0); m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Connecting to Storage Server"); m_gridManager = new GridManager(); @@ -129,7 +132,7 @@ namespace OpenGridServices.GridServer m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting sim status checker"); - Timer simCheckTimer = new Timer( 300000 ); // 5 minutes + System.Timers.Timer simCheckTimer = new System.Timers.Timer( 300000 ); // 5 minutes simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); simCheckTimer.Enabled = true; } diff --git a/ServiceManager/ServiceManager.cs b/ServiceManager/ServiceManager.cs index 6cd2113ef9..b21a5b1ef7 100644 --- a/ServiceManager/ServiceManager.cs +++ b/ServiceManager/ServiceManager.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Threading; using System.ServiceProcess; using System.Xml; @@ -65,8 +66,13 @@ public class OpenGridMasterService : System.ServiceProcess.ServiceBase { private static string SetupGrid() { Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server"); - // TODO: Drop the console! and then configure using CLI params and/or XML files - return ""; + Process p = new Process(); + + p.StartInfo.Arguments = "-setuponly"; + p.StartInfo.FileName = "OpenGridServices.GridServer.exe"; + p.Start(); + + return ""; // we let the gridserver handle it's own setup } private static string SetupUser()