*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
afrisby
mingchen 2007-08-15 19:08:27 +00:00
parent 94dded470d
commit ae20503dae
4 changed files with 40 additions and 2 deletions

View File

@ -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<string>(ref tempstrarray, tempstrarray.Length - 1);

View File

@ -64,6 +64,8 @@ namespace OpenSim
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
protected string m_startupCommandsFile = "";
protected List<UDPServer> m_udpServers = new List<UDPServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected List<Scene> m_localScenes = new List<Scene>();
@ -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)

View File

@ -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"

0
bin/startup_commands.txt Normal file
View File