aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs36
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs51
2 files changed, 47 insertions, 40 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 8bdda29..89d3507 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -61,8 +61,6 @@ namespace OpenSim.Framework.Servers
61 /// server. 61 /// server.
62 /// </summary> 62 /// </summary>
63 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); 63 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
64
65 protected string m_pidFile = String.Empty;
66 64
67 /// <summary> 65 /// <summary>
68 /// Random uuid for private data 66 /// Random uuid for private data
@@ -293,23 +291,6 @@ namespace OpenSim.Framework.Servers
293 MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId); 291 MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
294 } 292 }
295 293
296 protected void CreatePIDFile(string path)
297 {
298 try
299 {
300 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
301 FileStream fs = File.Create(path);
302
303 Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
304 fs.Write(buf, 0, buf.Length);
305 fs.Close();
306 m_pidFile = path;
307 }
308 catch (Exception)
309 {
310 }
311 }
312
313 public string osSecret { 294 public string osSecret {
314 // Secret uuid for the simulator 295 // Secret uuid for the simulator
315 get { return m_osSecret; } 296 get { return m_osSecret; }
@@ -327,20 +308,5 @@ namespace OpenSim.Framework.Servers
327 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); 308 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
328 } 309 }
329 } 310 }
330
331 protected void RemovePIDFile()
332 {
333 if (m_pidFile != String.Empty)
334 {
335 try
336 {
337 File.Delete(m_pidFile);
338 m_pidFile = String.Empty;
339 }
340 catch (Exception)
341 {
342 }
343 }
344 }
345 } 311 }
346} 312} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index 9973a2d..645b43a 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -55,6 +55,8 @@ namespace OpenSim.Framework.Servers
55 protected DateTime m_startuptime; 55 protected DateTime m_startuptime;
56 protected string m_startupDirectory = Environment.CurrentDirectory; 56 protected string m_startupDirectory = Environment.CurrentDirectory;
57 57
58 protected string m_pidFile = String.Empty;
59
58 /// <summary> 60 /// <summary>
59 /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. 61 /// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
60 /// </summary> 62 /// </summary>
@@ -67,6 +69,45 @@ namespace OpenSim.Framework.Servers
67 EnhanceVersionInformation(); 69 EnhanceVersionInformation();
68 } 70 }
69 71
72 protected void CreatePIDFile(string path)
73 {
74 try
75 {
76 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
77
78 using (FileStream fs = File.Create(path))
79 {
80 Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
81 fs.Write(buf, 0, buf.Length);
82 }
83
84 m_pidFile = path;
85
86 m_log.InfoFormat("[SERVER BASE]: Created pid file {0}", m_pidFile);
87 }
88 catch (Exception e)
89 {
90 m_log.Warn(string.Format("[SERVER BASE]: Could not create PID file at {0} ", path), e);
91 }
92 }
93
94 protected void RemovePIDFile()
95 {
96 if (m_pidFile != String.Empty)
97 {
98 try
99 {
100 File.Delete(m_pidFile);
101 }
102 catch (Exception e)
103 {
104 m_log.Error(string.Format("[SERVER BASE]: Error whilst removing {0} ", m_pidFile), e);
105 }
106
107 m_pidFile = String.Empty;
108 }
109 }
110
70 public void RegisterCommonAppenders(IConfig startupConfig) 111 public void RegisterCommonAppenders(IConfig startupConfig)
71 { 112 {
72 ILoggerRepository repository = LogManager.GetRepository(); 113 ILoggerRepository repository = LogManager.GetRepository();
@@ -109,7 +150,7 @@ namespace OpenSim.Framework.Servers
109 m_logFileAppender.ActivateOptions(); 150 m_logFileAppender.ActivateOptions();
110 } 151 }
111 152
112 m_log.InfoFormat("[LOGGING]: Logging started to file {0}", m_logFileAppender.File); 153 m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
113 } 154 }
114 } 155 }
115 156
@@ -243,26 +284,26 @@ namespace OpenSim.Framework.Servers
243 } 284 }
244 else if (File.Exists(gitRefPointerPath)) 285 else if (File.Exists(gitRefPointerPath))
245 { 286 {
246// m_log.DebugFormat("[OPENSIM]: Found {0}", gitRefPointerPath); 287// m_log.DebugFormat("[SERVER BASE]: Found {0}", gitRefPointerPath);
247 288
248 string rawPointer = ""; 289 string rawPointer = "";
249 290
250 using (StreamReader pointerFile = File.OpenText(gitRefPointerPath)) 291 using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
251 rawPointer = pointerFile.ReadLine(); 292 rawPointer = pointerFile.ReadLine();
252 293
253// m_log.DebugFormat("[OPENSIM]: rawPointer [{0}]", rawPointer); 294// m_log.DebugFormat("[SERVER BASE]: rawPointer [{0}]", rawPointer);
254 295
255 Match m = Regex.Match(rawPointer, "^ref: (.+)$"); 296 Match m = Regex.Match(rawPointer, "^ref: (.+)$");
256 297
257 if (m.Success) 298 if (m.Success)
258 { 299 {
259// m_log.DebugFormat("[OPENSIM]: Matched [{0}]", m.Groups[1].Value); 300// m_log.DebugFormat("[SERVER BASE]: Matched [{0}]", m.Groups[1].Value);
260 301
261 string gitRef = m.Groups[1].Value; 302 string gitRef = m.Groups[1].Value;
262 string gitRefPath = gitDir + gitRef; 303 string gitRefPath = gitDir + gitRef;
263 if (File.Exists(gitRefPath)) 304 if (File.Exists(gitRefPath))
264 { 305 {
265// m_log.DebugFormat("[OPENSIM]: Found gitRefPath [{0}]", gitRefPath); 306// m_log.DebugFormat("[SERVER BASE]: Found gitRefPath [{0}]", gitRefPath);
266 307
267 using (StreamReader refFile = File.OpenText(gitRefPath)) 308 using (StreamReader refFile = File.OpenText(gitRefPath))
268 { 309 {