aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authormingchen2007-08-15 19:08:27 +0000
committermingchen2007-08-15 19:08:27 +0000
commitae20503dae765b850d6acf6e30220b9688f30cac (patch)
treee1bb93fc5cc6b85ca7756687a9033c5cb8a7f862
parentMore work on inventory, can now create other inventory types, like Clothes an... (diff)
downloadopensim-SC_OLD-ae20503dae765b850d6acf6e30220b9688f30cac.zip
opensim-SC_OLD-ae20503dae765b850d6acf6e30220b9688f30cac.tar.gz
opensim-SC_OLD-ae20503dae765b850d6acf6e30220b9688f30cac.tar.bz2
opensim-SC_OLD-ae20503dae765b850d6acf6e30220b9688f30cac.tar.xz
*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
-rw-r--r--OpenSim/Framework/Console/LogBase.cs10
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs31
-rw-r--r--bin/OpenSim.ini1
-rw-r--r--bin/startup_commands.txt0
4 files changed, 40 insertions, 2 deletions
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs
index 2b831fe..5f16303 100644
--- a/OpenSim/Framework/Console/LogBase.cs
+++ b/OpenSim/Framework/Console/LogBase.cs
@@ -409,9 +409,15 @@ namespace OpenSim.Framework.Console
409 409
410 public void MainLogPrompt() 410 public void MainLogPrompt()
411 { 411 {
412 string[] tempstrarray; 412
413 string tempstr = this.CmdPrompt(this.componentname + "# "); 413 string tempstr = this.CmdPrompt(this.componentname + "# ");
414 tempstrarray = tempstr.Split(' '); 414 MainLogRunCommand(tempstr);
415 }
416
417 public void MainLogRunCommand(string command)
418 {
419 string[] tempstrarray;
420 tempstrarray = command.Split(' ');
415 string cmd = tempstrarray[0]; 421 string cmd = tempstrarray[0];
416 Array.Reverse(tempstrarray); 422 Array.Reverse(tempstrarray);
417 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); 423 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
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
64 64
65 protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; 65 protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
66 66
67 protected string m_startupCommandsFile = "";
68
67 protected List<UDPServer> m_udpServers = new List<UDPServer>(); 69 protected List<UDPServer> m_udpServers = new List<UDPServer>();
68 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 70 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
69 protected List<Scene> m_localScenes = new List<Scene>(); 71 protected List<Scene> m_localScenes = new List<Scene>();
@@ -105,6 +107,8 @@ namespace OpenSim
105 107
106 m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); 108 m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
107 109
110 m_startupCommandsFile = configSource.Configs["Startup"].GetString("startup_console_commands_file", "");
111
108 standaloneAuthenticate = configSource.Configs["Startup"].GetBoolean("standalone_authenticate", false); 112 standaloneAuthenticate = configSource.Configs["Startup"].GetBoolean("standalone_authenticate", false);
109 welcomeMessage = configSource.Configs["Startup"].GetString("standalone_welcome", "Welcome to OpenSim"); 113 welcomeMessage = configSource.Configs["Startup"].GetString("standalone_welcome", "Welcome to OpenSim");
110 } 114 }
@@ -184,6 +188,33 @@ namespace OpenSim
184 { 188 {
185 this.m_udpServers[i].ServerListener(); 189 this.m_udpServers[i].ServerListener();
186 } 190 }
191
192 //Run Startup Commands
193 if (m_startupCommandsFile != "")
194 {
195 MainLog.Instance.Verbose("Running startup command script (" + m_startupCommandsFile + ")");
196 if (File.Exists(m_startupCommandsFile))
197 {
198 StreamReader readFile = File.OpenText(m_startupCommandsFile);
199 string currentCommand = "";
200 while ((currentCommand = readFile.ReadLine()) != null)
201 {
202 if (currentCommand != "")
203 {
204 MainLog.Instance.Verbose("Running '" + currentCommand + "'");
205 MainLog.Instance.MainLogRunCommand(currentCommand);
206 }
207 }
208 }
209 else
210 {
211 MainLog.Instance.Error("Startup command script missing. Will not run startup commands");
212 }
213 }
214 else
215 {
216 MainLog.Instance.Verbose("No startup command script specified. Moving on...");
217 }
187 } 218 }
188 219
189 private static void CreateDefaultRegionInfoXml(string fileName) 220 private static void CreateDefaultRegionInfoXml(string fileName)
diff --git a/bin/OpenSim.ini b/bin/OpenSim.ini
index c2cbdec..4e9b79a 100644
--- a/bin/OpenSim.ini
+++ b/bin/OpenSim.ini
@@ -2,5 +2,6 @@
2gridmode = false 2gridmode = false
3physics = basicphysics 3physics = basicphysics
4storage_plugin = "OpenSim.DataStore.NullStorage.dll" 4storage_plugin = "OpenSim.DataStore.NullStorage.dll"
5startup_console_commands_file = "startup_commands.txt"
5standalone_authenticate = false 6standalone_authenticate = false
6standalone_welcome = "Welcome to OpenSim" \ No newline at end of file 7standalone_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 0000000..e69de29
--- /dev/null
+++ b/bin/startup_commands.txt