Add a PIDFile in [Startup], which the PID will be written to
parent
1a25969096
commit
76ca096384
|
@ -73,6 +73,8 @@ namespace OpenSim.Framework.Servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected string m_version;
|
protected string m_version;
|
||||||
|
|
||||||
|
protected string m_pidFile = String.Empty;
|
||||||
|
|
||||||
protected BaseHttpServer m_httpServer;
|
protected BaseHttpServer m_httpServer;
|
||||||
public BaseHttpServer HttpServer
|
public BaseHttpServer HttpServer
|
||||||
{
|
{
|
||||||
|
@ -278,6 +280,7 @@ namespace OpenSim.Framework.Servers
|
||||||
ShutdownSpecific();
|
ShutdownSpecific();
|
||||||
|
|
||||||
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
|
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
|
||||||
|
RemovePIDFile();
|
||||||
|
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
@ -433,5 +436,38 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CreatePIDFile(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
||||||
|
FileStream fs = File.Create(path);
|
||||||
|
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||||
|
Byte[] buf = enc.GetBytes(pidstring);
|
||||||
|
fs.Write(buf, 0, buf.Length);
|
||||||
|
fs.Close();
|
||||||
|
m_pidFile = path;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void RemovePIDFile()
|
||||||
|
{
|
||||||
|
if (m_pidFile != String.Empty)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(m_pidFile);
|
||||||
|
m_pidFile = String.Empty;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,14 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void StartupSpecific()
|
protected override void StartupSpecific()
|
||||||
{
|
{
|
||||||
|
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
||||||
|
if (startupConfig != null)
|
||||||
|
{
|
||||||
|
string pidFile = startupConfig.GetString("PIDFile", String.Empty);
|
||||||
|
if (pidFile != String.Empty)
|
||||||
|
CreatePIDFile(pidFile);
|
||||||
|
}
|
||||||
|
|
||||||
base.StartupSpecific();
|
base.StartupSpecific();
|
||||||
|
|
||||||
m_stats = StatsManager.StartCollectingSimExtraStats();
|
m_stats = StatsManager.StartCollectingSimExtraStats();
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt)
|
; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt)
|
||||||
crash_dir = "crashes"
|
crash_dir = "crashes"
|
||||||
|
|
||||||
|
; Place to create a PID file
|
||||||
|
; PIDFile = "/tmp/my.pid"
|
||||||
|
|
||||||
; Http proxy support for llHTTPRequest and dynamic texture loading
|
; Http proxy support for llHTTPRequest and dynamic texture loading
|
||||||
; Set HttpProxy to the URL for your proxy server if you would like
|
; Set HttpProxy to the URL for your proxy server if you would like
|
||||||
; to proxy llHTTPRequests through a firewall
|
; to proxy llHTTPRequests through a firewall
|
||||||
|
|
Loading…
Reference in New Issue