*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.iniafrisby
parent
94dded470d
commit
ae20503dae
|
@ -409,9 +409,15 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
public void MainLogPrompt()
|
public void MainLogPrompt()
|
||||||
{
|
{
|
||||||
string[] tempstrarray;
|
|
||||||
string tempstr = this.CmdPrompt(this.componentname + "# ");
|
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];
|
string cmd = tempstrarray[0];
|
||||||
Array.Reverse(tempstrarray);
|
Array.Reverse(tempstrarray);
|
||||||
Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
|
Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
|
||||||
|
|
|
@ -64,6 +64,8 @@ namespace OpenSim
|
||||||
|
|
||||||
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
|
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
|
||||||
|
|
||||||
|
protected string m_startupCommandsFile = "";
|
||||||
|
|
||||||
protected List<UDPServer> m_udpServers = new List<UDPServer>();
|
protected List<UDPServer> m_udpServers = new List<UDPServer>();
|
||||||
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
|
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
|
||||||
protected List<Scene> m_localScenes = new List<Scene>();
|
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_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);
|
standaloneAuthenticate = configSource.Configs["Startup"].GetBoolean("standalone_authenticate", false);
|
||||||
welcomeMessage = configSource.Configs["Startup"].GetString("standalone_welcome", "Welcome to OpenSim");
|
welcomeMessage = configSource.Configs["Startup"].GetString("standalone_welcome", "Welcome to OpenSim");
|
||||||
}
|
}
|
||||||
|
@ -184,6 +188,33 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
this.m_udpServers[i].ServerListener();
|
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)
|
private static void CreateDefaultRegionInfoXml(string fileName)
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
gridmode = false
|
gridmode = false
|
||||||
physics = basicphysics
|
physics = basicphysics
|
||||||
storage_plugin = "OpenSim.DataStore.NullStorage.dll"
|
storage_plugin = "OpenSim.DataStore.NullStorage.dll"
|
||||||
|
startup_console_commands_file = "startup_commands.txt"
|
||||||
standalone_authenticate = false
|
standalone_authenticate = false
|
||||||
standalone_welcome = "Welcome to OpenSim"
|
standalone_welcome = "Welcome to OpenSim"
|
Loading…
Reference in New Issue