From ae20503dae765b850d6acf6e30220b9688f30cac Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 15 Aug 2007 19:08:27 +0000 Subject: *Added the ability to run commands after all regions have started up *By default, it is set to startup_commands.txt. Simply add a list of commands separated by a new line to be run or change the file by changing the path of a startup commands file in OpenSim.ini --- OpenSim/Region/Application/OpenSimMain.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 9f95e01..2ca3f46 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) -- cgit v1.1