Factor out common registration of "show uptime" command
parent
08234d0097
commit
632dad337b
|
@ -118,8 +118,9 @@ namespace OpenSim.Framework.Servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void StartupSpecific()
|
protected virtual void StartupSpecific()
|
||||||
{
|
{
|
||||||
if (m_console != null)
|
if (m_console == null)
|
||||||
{
|
return;
|
||||||
|
|
||||||
ILoggerRepository repository = LogManager.GetRepository();
|
ILoggerRepository repository = LogManager.GetRepository();
|
||||||
IAppender[] appenders = repository.GetAppenders();
|
IAppender[] appenders = repository.GetAppenders();
|
||||||
|
|
||||||
|
@ -148,6 +149,8 @@ namespace OpenSim.Framework.Servers
|
||||||
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterCommonCommands();
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "quit",
|
m_console.Commands.AddCommand("General", false, "quit",
|
||||||
"quit",
|
"quit",
|
||||||
"Quit the application", HandleQuit);
|
"Quit the application", HandleQuit);
|
||||||
|
@ -168,10 +171,6 @@ namespace OpenSim.Framework.Servers
|
||||||
"show threads",
|
"show threads",
|
||||||
"Show thread status", HandleShow);
|
"Show thread status", HandleShow);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show uptime",
|
|
||||||
"show uptime",
|
|
||||||
"Show server uptime", HandleShow);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show version",
|
m_console.Commands.AddCommand("General", false, "show version",
|
||||||
"show version",
|
"show version",
|
||||||
"Show server version", HandleShow);
|
"Show server version", HandleShow);
|
||||||
|
@ -190,7 +189,6 @@ namespace OpenSim.Framework.Servers
|
||||||
"Manually invoke runtime garbage collection. For debugging purposes",
|
"Manually invoke runtime garbage collection. For debugging purposes",
|
||||||
HandleForceGc);
|
HandleForceGc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleForceGc(string module, string[] args)
|
private void HandleForceGc(string module, string[] args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,18 @@ namespace OpenSim.Framework.Servers
|
||||||
m_startuptime = DateTime.Now;
|
m_startuptime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register common commands once m_console has been set if it is going to be set
|
||||||
|
/// </summary>
|
||||||
|
public void RegisterCommonCommands()
|
||||||
|
{
|
||||||
|
if (m_console == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "show uptime", "show uptime", "Show server uptime", HandleShow);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void HandleShow(string module, string[] cmd)
|
public virtual void HandleShow(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
List<string> args = new List<string>(cmd);
|
List<string> args = new List<string>(cmd);
|
||||||
|
|
|
@ -239,6 +239,8 @@ namespace OpenSim.Server.Base
|
||||||
CreatePIDFile(startupConfig.GetString("PIDFile"));
|
CreatePIDFile(startupConfig.GetString("PIDFile"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterCommonCommands();
|
||||||
|
|
||||||
// Register the quit command
|
// Register the quit command
|
||||||
//
|
//
|
||||||
MainConsole.Instance.Commands.AddCommand("General", false, "quit",
|
MainConsole.Instance.Commands.AddCommand("General", false, "quit",
|
||||||
|
@ -254,11 +256,6 @@ namespace OpenSim.Server.Base
|
||||||
"command-script <script>",
|
"command-script <script>",
|
||||||
"Run a command script from file", HandleScript);
|
"Run a command script from file", HandleScript);
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("General", false, "show uptime",
|
|
||||||
"show uptime",
|
|
||||||
"Show server uptime", HandleShow);
|
|
||||||
|
|
||||||
|
|
||||||
// Allow derived classes to perform initialization that
|
// Allow derived classes to perform initialization that
|
||||||
// needs to be done after the console has opened
|
// needs to be done after the console has opened
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue