aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-08-24 16:17:57 +0000
committerMW2007-08-24 16:17:57 +0000
commit4276a352bcef890f3487ff701fba2de617d2c3de (patch)
treec658eb9abd5fe90e404a4359bb3dcad0506c0fe3
parentit helps to actually call TestTables to get the new tables created (diff)
downloadopensim-SC_OLD-4276a352bcef890f3487ff701fba2de617d2c3de.zip
opensim-SC_OLD-4276a352bcef890f3487ff701fba2de617d2c3de.tar.gz
opensim-SC_OLD-4276a352bcef890f3487ff701fba2de617d2c3de.tar.bz2
opensim-SC_OLD-4276a352bcef890f3487ff701fba2de617d2c3de.tar.xz
Small bit of refactoring to the startup command script code (moved it into a separate method), so that I could add a new CLI command of "command-script <fileName>", so that as well as the startup command script still being processed on startup. A user can create other command scripts and use the single command ("command-script <filename>") to run them at any time. Could be useful for trying out various configurations etc.
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs42
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs6
2 files changed, 29 insertions, 19 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 867f16f..07ab34d 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -205,28 +205,33 @@ namespace OpenSim
205 //Run Startup Commands 205 //Run Startup Commands
206 if (m_startupCommandsFile != "") 206 if (m_startupCommandsFile != "")
207 { 207 {
208 MainLog.Instance.Verbose("Running startup command script (" + m_startupCommandsFile + ")"); 208 RunCommandScript(m_startupCommandsFile);
209 if (File.Exists(m_startupCommandsFile)) 209 }
210 else
211 {
212 MainLog.Instance.Verbose("No startup command script specified. Moving on...");
213 }
214 }
215
216 private void RunCommandScript(string fileName)
217 {
218 MainLog.Instance.Verbose("Running command script (" + fileName + ")");
219 if (File.Exists(fileName))
220 {
221 StreamReader readFile = File.OpenText(fileName);
222 string currentCommand = "";
223 while ((currentCommand = readFile.ReadLine()) != null)
210 { 224 {
211 StreamReader readFile = File.OpenText(m_startupCommandsFile); 225 if (currentCommand != "")
212 string currentCommand = "";
213 while ((currentCommand = readFile.ReadLine()) != null)
214 { 226 {
215 if (currentCommand != "") 227 MainLog.Instance.Verbose("Running '" + currentCommand + "'");
216 { 228 MainLog.Instance.MainLogRunCommand(currentCommand);
217 MainLog.Instance.Verbose("Running '" + currentCommand + "'");
218 MainLog.Instance.MainLogRunCommand(currentCommand);
219 }
220 } 229 }
221 } 230 }
222 else
223 {
224 MainLog.Instance.Error("Startup command script missing. Will not run startup commands");
225 }
226 } 231 }
227 else 232 else
228 { 233 {
229 MainLog.Instance.Verbose("No startup command script specified. Moving on..."); 234 MainLog.Instance.Error("Command script missing. Can not run commands");
230 } 235 }
231 } 236 }
232 237
@@ -403,6 +408,13 @@ namespace OpenSim
403 } 408 }
404 break; 409 break;
405 410
411 case "command-script":
412 if (cmdparams.Length > 0)
413 {
414 RunCommandScript(cmdparams[0]);
415 }
416 break;
417
406 case "permissions": 418 case "permissions":
407 // Treats each user as a super-admin when disabled 419 // Treats each user as a super-admin when disabled
408 foreach (Scene scene in m_localScenes) 420 foreach (Scene scene in m_localScenes)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 2f345f4..1ed0642 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -207,8 +207,7 @@ namespace OpenSim.Region.Environment.LandManagement
207 207
208 if (x > 63 || y > 63 || x < 0 || y < 0) 208 if (x > 63 || y > 63 || x < 0 || y < 0)
209 { 209 {
210 return null; 210 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
211 //throw new Exception("Error: Parcel not found at point " + x + ", " + y);
212 } 211 }
213 else 212 else
214 { 213 {
@@ -221,8 +220,7 @@ namespace OpenSim.Region.Environment.LandManagement
221 { 220 {
222 if (x > 256 || y > 256 || x < 0 || y < 0) 221 if (x > 256 || y > 256 || x < 0 || y < 0)
223 { 222 {
224 return null; 223 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
225 //throw new Exception("Error: Parcel not found at point " + x + ", " + y);
226 } 224 }
227 else 225 else
228 { 226 {