aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base
diff options
context:
space:
mode:
authorMelanie2009-08-19 04:39:02 +0100
committerMelanie2009-08-19 04:39:02 +0100
commit99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53 (patch)
tree81cbdfaeae6ce37ce16463c602e6cb8b9077f275 /OpenSim/Server/Base
parentFixes mantis #4020 (http://opensimulator.org/mantis/view.php?id=4020) (diff)
downloadopensim-SC_OLD-99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53.zip
opensim-SC_OLD-99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53.tar.gz
opensim-SC_OLD-99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53.tar.bz2
opensim-SC_OLD-99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53.tar.xz
Add rest console support to the user server. Will ask new questions at
startup. To use, run it normally once, answering the questions, then run again with -console=rest. Also now supports -console=basic for a console that reads stdin
Diffstat (limited to 'OpenSim/Server/Base')
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 619c2d1..1d9eb0d 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -65,6 +65,10 @@ namespace OpenSim.Server.Base
65 // 65 //
66 private bool m_Running = true; 66 private bool m_Running = true;
67 67
68 // PID file
69 //
70 private string m_pidFile = String.Empty;
71
68 // Handle all the automagical stuff 72 // Handle all the automagical stuff
69 // 73 //
70 public ServicesServerBase(string prompt, string[] args) 74 public ServicesServerBase(string prompt, string[] args)
@@ -211,6 +215,11 @@ namespace OpenSim.Server.Base
211 } 215 }
212 } 216 }
213 217
218 if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty)
219 {
220 CreatePIDFile(startupConfig.GetString("PIDFile"));
221 }
222
214 // Register the quit command 223 // Register the quit command
215 // 224 //
216 MainConsole.Instance.Commands.AddCommand("base", false, "quit", 225 MainConsole.Instance.Commands.AddCommand("base", false, "quit",
@@ -230,6 +239,8 @@ namespace OpenSim.Server.Base
230 MainConsole.Instance.Prompt(); 239 MainConsole.Instance.Prompt();
231 } 240 }
232 241
242 if (m_pidFile != String.Empty)
243 File.Delete(m_pidFile);
233 return 0; 244 return 0;
234 } 245 }
235 246
@@ -246,5 +257,22 @@ namespace OpenSim.Server.Base
246 protected virtual void Initialise() 257 protected virtual void Initialise()
247 { 258 {
248 } 259 }
260
261 protected void CreatePIDFile(string path)
262 {
263 try
264 {
265 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
266 FileStream fs = File.Create(path);
267 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
268 Byte[] buf = enc.GetBytes(pidstring);
269 fs.Write(buf, 0, buf.Length);
270 fs.Close();
271 m_pidFile = path;
272 }
273 catch (Exception)
274 {
275 }
276 }
249 } 277 }
250} 278}