diff options
author | Melanie | 2012-09-07 19:49:46 +0100 |
---|---|---|
committer | Melanie | 2012-09-07 19:49:46 +0100 |
commit | 924df14c5e15185e14c144164dd80d9859d5c583 (patch) | |
tree | 110f0e402b879f49943ff2e76598e2241e20057c /OpenSim/Server | |
parent | Revert "made setting rotation match Second Life" (diff) | |
parent | Move addin attributes to RegionCombinerModule.addin.xml (diff) | |
download | opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.zip opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.gz opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.bz2 opensim-SC_OLD-924df14c5e15185e14c144164dd80d9859d5c583.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
OpenSim/Framework/Servers/VersionInfo.cs
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index b137c05..0cff6ed 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -71,10 +72,17 @@ namespace OpenSim.Server.Base | |||
71 | // | 72 | // |
72 | private string m_pidFile = String.Empty; | 73 | private string m_pidFile = String.Empty; |
73 | 74 | ||
75 | /// <summary> | ||
76 | /// Time at which this server was started | ||
77 | /// </summary> | ||
78 | protected DateTime m_startuptime; | ||
79 | |||
74 | // Handle all the automagical stuff | 80 | // Handle all the automagical stuff |
75 | // | 81 | // |
76 | public ServicesServerBase(string prompt, string[] args) | 82 | public ServicesServerBase(string prompt, string[] args) |
77 | { | 83 | { |
84 | m_startuptime = DateTime.Now; | ||
85 | |||
78 | // Save raw arguments | 86 | // Save raw arguments |
79 | // | 87 | // |
80 | m_Arguments = args; | 88 | m_Arguments = args; |
@@ -250,6 +258,10 @@ namespace OpenSim.Server.Base | |||
250 | "command-script <script>", | 258 | "command-script <script>", |
251 | "Run a command script from file", HandleScript); | 259 | "Run a command script from file", HandleScript); |
252 | 260 | ||
261 | MainConsole.Instance.Commands.AddCommand("General", false, "show uptime", | ||
262 | "show uptime", | ||
263 | "Show server uptime", HandleShow); | ||
264 | |||
253 | 265 | ||
254 | // Allow derived classes to perform initialization that | 266 | // Allow derived classes to perform initialization that |
255 | // needs to be done after the console has opened | 267 | // needs to be done after the console has opened |
@@ -345,5 +357,34 @@ namespace OpenSim.Server.Base | |||
345 | { | 357 | { |
346 | } | 358 | } |
347 | } | 359 | } |
360 | |||
361 | public virtual void HandleShow(string module, string[] cmd) | ||
362 | { | ||
363 | List<string> args = new List<string>(cmd); | ||
364 | |||
365 | args.RemoveAt(0); | ||
366 | |||
367 | string[] showParams = args.ToArray(); | ||
368 | |||
369 | switch (showParams[0]) | ||
370 | { | ||
371 | case "uptime": | ||
372 | MainConsole.Instance.Output(GetUptimeReport()); | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /// <summary> | ||
378 | /// Return a report about the uptime of this server | ||
379 | /// </summary> | ||
380 | /// <returns></returns> | ||
381 | protected string GetUptimeReport() | ||
382 | { | ||
383 | StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); | ||
384 | sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); | ||
385 | sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); | ||
386 | |||
387 | return sb.ToString(); | ||
388 | } | ||
348 | } | 389 | } |
349 | } | 390 | } |