aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-22 05:14:08 +0000
committerJustin Clark-Casey (justincc)2012-11-22 05:14:43 +0000
commit8269d2b893af47ad44e66a7918d472086adaddbb (patch)
treeca9566b749a05f4ac0168fa2d058e30ba6ff71d3 /OpenSim/Server/Base
parentAdd "get log level" command - this returns the current server session console... (diff)
downloadopensim-SC-8269d2b893af47ad44e66a7918d472086adaddbb.zip
opensim-SC-8269d2b893af47ad44e66a7918d472086adaddbb.tar.gz
opensim-SC-8269d2b893af47ad44e66a7918d472086adaddbb.tar.bz2
opensim-SC-8269d2b893af47ad44e66a7918d472086adaddbb.tar.xz
Factor out common pid file creation and removal code.
Log path at which pid file is created or reason for failure to create.
Diffstat (limited to 'OpenSim/Server/Base')
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs25
1 files changed, 3 insertions, 22 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 4eed7d5..ade4bab 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -69,10 +69,6 @@ namespace OpenSim.Server.Base
69 // 69 //
70 private bool m_Running = true; 70 private bool m_Running = true;
71 71
72 // PID file
73 //
74 private string m_pidFile = String.Empty;
75
76 // Handle all the automagical stuff 72 // Handle all the automagical stuff
77 // 73 //
78 public ServicesServerBase(string prompt, string[] args) : base() 74 public ServicesServerBase(string prompt, string[] args) : base()
@@ -240,8 +236,8 @@ namespace OpenSim.Server.Base
240 } 236 }
241 } 237 }
242 238
243 if (m_pidFile != String.Empty) 239 RemovePIDFile();
244 File.Delete(m_pidFile); 240
245 return 0; 241 return 0;
246 } 242 }
247 243
@@ -249,6 +245,7 @@ namespace OpenSim.Server.Base
249 { 245 {
250 m_Running = false; 246 m_Running = false;
251 m_log.Info("[CONSOLE] Quitting"); 247 m_log.Info("[CONSOLE] Quitting");
248
252 } 249 }
253 250
254 protected virtual void HandleScript(string module, string[] parms) 251 protected virtual void HandleScript(string module, string[] parms)
@@ -292,21 +289,5 @@ namespace OpenSim.Server.Base
292 protected virtual void Initialise() 289 protected virtual void Initialise()
293 { 290 {
294 } 291 }
295
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 Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
303 fs.Write(buf, 0, buf.Length);
304 fs.Close();
305 m_pidFile = path;
306 }
307 catch (Exception)
308 {
309 }
310 }
311 } 292 }
312} \ No newline at end of file 293} \ No newline at end of file