aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs36
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs10
-rw-r--r--bin/OpenSim.ini.example3
3 files changed, 48 insertions, 1 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 8ede8f5..9794a10 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -73,6 +73,8 @@ namespace OpenSim.Framework.Servers
73 /// </summary> 73 /// </summary>
74 protected string m_version; 74 protected string m_version;
75 75
76 protected string m_pidFile = String.Empty;
77
76 protected BaseHttpServer m_httpServer; 78 protected BaseHttpServer m_httpServer;
77 public BaseHttpServer HttpServer 79 public BaseHttpServer HttpServer
78 { 80 {
@@ -278,6 +280,7 @@ namespace OpenSim.Framework.Servers
278 ShutdownSpecific(); 280 ShutdownSpecific();
279 281
280 m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); 282 m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
283 RemovePIDFile();
281 284
282 Environment.Exit(0); 285 Environment.Exit(0);
283 } 286 }
@@ -433,5 +436,38 @@ namespace OpenSim.Framework.Servers
433 436
434 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); 437 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
435 } 438 }
439
440 protected void CreatePIDFile(string path)
441 {
442 try
443 {
444 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
445 FileStream fs = File.Create(path);
446 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
447 Byte[] buf = enc.GetBytes(pidstring);
448 fs.Write(buf, 0, buf.Length);
449 fs.Close();
450 m_pidFile = path;
451 }
452 catch (Exception)
453 {
454 }
455 }
456
457
458 protected void RemovePIDFile()
459 {
460 if (m_pidFile != String.Empty)
461 {
462 try
463 {
464 File.Delete(m_pidFile);
465 m_pidFile = String.Empty;
466 }
467 catch (Exception)
468 {
469 }
470 }
471 }
436 } 472 }
437} 473}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index ffabdd8..4cdb074 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -188,6 +188,14 @@ namespace OpenSim
188 /// </summary> 188 /// </summary>
189 protected override void StartupSpecific() 189 protected override void StartupSpecific()
190 { 190 {
191 IConfig startupConfig = m_config.Source.Configs["Startup"];
192 if (startupConfig != null)
193 {
194 string pidFile = startupConfig.GetString("PIDFile", String.Empty);
195 if (pidFile != String.Empty)
196 CreatePIDFile(pidFile);
197 }
198
191 base.StartupSpecific(); 199 base.StartupSpecific();
192 200
193 m_stats = StatsManager.StartCollectingSimExtraStats(); 201 m_stats = StatsManager.StartCollectingSimExtraStats();
@@ -857,4 +865,4 @@ namespace OpenSim
857 } 865 }
858 } 866 }
859 } 867 }
860} \ No newline at end of file 868}
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 9937cb9..7b2d370 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -7,6 +7,9 @@
7 ; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt) 7 ; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt)
8 crash_dir = "crashes" 8 crash_dir = "crashes"
9 9
10 ; Place to create a PID file
11 ; PIDFile = "/tmp/my.pid"
12
10 ; Http proxy support for llHTTPRequest and dynamic texture loading 13 ; Http proxy support for llHTTPRequest and dynamic texture loading
11 ; Set HttpProxy to the URL for your proxy server if you would like 14 ; Set HttpProxy to the URL for your proxy server if you would like
12 ; to proxy llHTTPRequests through a firewall 15 ; to proxy llHTTPRequests through a firewall