diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index 2b831fe52d..5f16303258 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs @@ -409,9 +409,15 @@ namespace OpenSim.Framework.Console public void MainLogPrompt() { - string[] tempstrarray; + string tempstr = this.CmdPrompt(this.componentname + "# "); - tempstrarray = tempstr.Split(' '); + MainLogRunCommand(tempstr); + } + + public void MainLogRunCommand(string command) + { + string[] tempstrarray; + tempstrarray = command.Split(' '); string cmd = tempstrarray[0]; Array.Reverse(tempstrarray); Array.Resize(ref tempstrarray, tempstrarray.Length - 1); diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 9f95e01537..2ca3f466df 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -64,6 +64,8 @@ namespace OpenSim protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; + protected string m_startupCommandsFile = ""; + protected List m_udpServers = new List(); protected List m_regionData = new List(); protected List m_localScenes = new List(); @@ -105,6 +107,8 @@ namespace OpenSim m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); + m_startupCommandsFile = configSource.Configs["Startup"].GetString("startup_console_commands_file", ""); + standaloneAuthenticate = configSource.Configs["Startup"].GetBoolean("standalone_authenticate", false); welcomeMessage = configSource.Configs["Startup"].GetString("standalone_welcome", "Welcome to OpenSim"); } @@ -184,6 +188,33 @@ namespace OpenSim { this.m_udpServers[i].ServerListener(); } + + //Run Startup Commands + if (m_startupCommandsFile != "") + { + MainLog.Instance.Verbose("Running startup command script (" + m_startupCommandsFile + ")"); + if (File.Exists(m_startupCommandsFile)) + { + StreamReader readFile = File.OpenText(m_startupCommandsFile); + string currentCommand = ""; + while ((currentCommand = readFile.ReadLine()) != null) + { + if (currentCommand != "") + { + MainLog.Instance.Verbose("Running '" + currentCommand + "'"); + MainLog.Instance.MainLogRunCommand(currentCommand); + } + } + } + else + { + MainLog.Instance.Error("Startup command script missing. Will not run startup commands"); + } + } + else + { + MainLog.Instance.Verbose("No startup command script specified. Moving on..."); + } } private static void CreateDefaultRegionInfoXml(string fileName) diff --git a/bin/OpenSim.ini b/bin/OpenSim.ini index c2cbdec52e..4e9b79a12f 100644 --- a/bin/OpenSim.ini +++ b/bin/OpenSim.ini @@ -2,5 +2,6 @@ gridmode = false physics = basicphysics storage_plugin = "OpenSim.DataStore.NullStorage.dll" +startup_console_commands_file = "startup_commands.txt" standalone_authenticate = false standalone_welcome = "Welcome to OpenSim" \ No newline at end of file diff --git a/bin/startup_commands.txt b/bin/startup_commands.txt new file mode 100644 index 0000000000..e69de29bb2