aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/GridConfig.cs16
-rw-r--r--OpenSim/Framework/MessageServerConfig.cs16
-rw-r--r--OpenSim/Framework/UserConfig.cs14
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs27
-rw-r--r--OpenSim/Grid/GridServer/Program.cs12
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs79
-rw-r--r--OpenSim/Grid/UserServer/Main.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs28
-rw-r--r--prebuild.xml3
10 files changed, 233 insertions, 26 deletions
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index a3c1032..87fd3f0 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Framework
45 public string SimSendKey = String.Empty; 45 public string SimSendKey = String.Empty;
46 public string UserRecvKey = String.Empty; 46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty; 47 public string UserSendKey = String.Empty;
48 public string ConsoleUser = String.Empty;
49 public string ConsolePass = String.Empty;
48 50
49 public GridConfig(string description, string filename) 51 public GridConfig(string description, string filename)
50 { 52 {
@@ -95,6 +97,12 @@ namespace OpenSim.Framework
95 "Allow regions to register immediately upon grid server startup? true/false", 97 "Allow regions to register immediately upon grid server startup? true/false",
96 "True", 98 "True",
97 false); 99 false);
100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
101 "Remote console access user name [Default: disabled]", "0", false);
102
103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Remote console access password [Default: disabled]", "0", false);
105
98 } 106 }
99 107
100 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 108 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -140,9 +148,15 @@ namespace OpenSim.Framework
140 case "allow_region_registration": 148 case "allow_region_registration":
141 AllowRegionRegistration = (bool)configuration_result; 149 AllowRegionRegistration = (bool)configuration_result;
142 break; 150 break;
151 case "console_user":
152 ConsoleUser = (string)configuration_result;
153 break;
154 case "console_pass":
155 ConsolePass = (string)configuration_result;
156 break;
143 } 157 }
144 158
145 return true; 159 return true;
146 } 160 }
147 } 161 }
148} \ No newline at end of file 162}
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs
index d0ceebc..61e5ea7 100644
--- a/OpenSim/Framework/MessageServerConfig.cs
+++ b/OpenSim/Framework/MessageServerConfig.cs
@@ -46,6 +46,8 @@ namespace OpenSim.Framework
46 public string UserRecvKey = String.Empty; 46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty; 47 public string UserSendKey = String.Empty;
48 public string UserServerURL = String.Empty; 48 public string UserServerURL = String.Empty;
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
49 51
50 public MessageServerConfig(string description, string filename) 52 public MessageServerConfig(string description, string filename)
51 { 53 {
@@ -88,6 +90,12 @@ namespace OpenSim.Framework
88 "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false); 90 "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false);
89 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 91 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
90 "My Published IP Address", "127.0.0.1", false); 92 "My Published IP Address", "127.0.0.1", false);
93 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Remote console access user name [Default: disabled]", "0", false);
95
96 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
97 "Remote console access password [Default: disabled]", "0", false);
98
91 } 99 }
92 100
93 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 101 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -130,9 +138,15 @@ namespace OpenSim.Framework
130 case "published_ip": 138 case "published_ip":
131 MessageServerIP = (string) configuration_result; 139 MessageServerIP = (string) configuration_result;
132 break; 140 break;
141 case "console_user":
142 ConsoleUser = (string)configuration_result;
143 break;
144 case "console_pass":
145 ConsolePass = (string)configuration_result;
146 break;
133 } 147 }
134 148
135 return true; 149 return true;
136 } 150 }
137 } 151 }
138} \ No newline at end of file 152}
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index 31838ad..b9e3665 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -46,6 +46,8 @@ namespace OpenSim.Framework
46 public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL; 46 public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL;
47 public uint DefaultUserLevel = 0; 47 public uint DefaultUserLevel = 0;
48 public string LibraryXmlfile = ""; 48 public string LibraryXmlfile = "";
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
49 51
50 private Uri m_inventoryUrl; 52 private Uri m_inventoryUrl;
51 53
@@ -155,6 +157,12 @@ namespace OpenSim.Framework
155 m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 157 m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
156 "Minimum Level a user should have to login [0 default]", "0", false); 158 "Minimum Level a user should have to login [0 default]", "0", false);
157 159
160 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
161 "Remote console access user name [Default: disabled]", "0", false);
162
163 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
164 "Remote console access password [Default: disabled]", "0", false);
165
158 } 166 }
159 167
160 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 168 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -209,6 +217,12 @@ namespace OpenSim.Framework
209 case "library_location": 217 case "library_location":
210 LibraryXmlfile = (string)configuration_result; 218 LibraryXmlfile = (string)configuration_result;
211 break; 219 break;
220 case "console_user":
221 ConsoleUser = (string)configuration_result;
222 break;
223 case "console_pass":
224 ConsolePass = (string)configuration_result;
225 break;
212 } 226 }
213 227
214 return true; 228 return true;
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index c41a728..e3ad52a 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
@@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 protected GridConfig m_config; 49 protected GridConfig m_config;
50 public string m_consoleType = "local";
51 public IConfigSource m_configSource = null;
49 52
50 public GridConfig Config 53 public GridConfig Config
51 { 54 {
@@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer
71 74
72 public GridServerBase() 75 public GridServerBase()
73 { 76 {
74 m_console = new LocalConsole("Grid");
75 MainConsole.Instance = m_console;
76 } 77 }
77 78
78 protected override void StartupSpecific() 79 protected override void StartupSpecific()
79 { 80 {
81 switch (m_consoleType)
82 {
83 case "rest":
84 m_console = new RemoteConsole("Grid");
85 break;
86 case "basic":
87 m_console = new CommandConsole("Grid");
88 break;
89 default:
90 m_console = new LocalConsole("Grid");
91 break;
92 }
93 MainConsole.Instance = m_console;
80 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 94 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
81 95
82 m_log.Info("[GRID]: Starting HTTP process"); 96 m_log.Info("[GRID]: Starting HTTP process");
83 m_httpServer = new BaseHttpServer(m_config.HttpPort); 97 m_httpServer = new BaseHttpServer(m_config.HttpPort);
98 if (m_console is RemoteConsole)
99 {
100 RemoteConsole c = (RemoteConsole)m_console;
101 c.SetServer(m_httpServer);
102 IConfig netConfig = m_configSource.AddConfig("Network");
103 netConfig.Set("ConsoleUser", m_config.ConsoleUser);
104 netConfig.Set("ConsolePass", m_config.ConsolePass);
105 c.ReadConfig(m_configSource);
106 }
84 107
85 LoadPlugins(); 108 LoadPlugins();
86 109
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs
index 9618b85..c7ba897 100644
--- a/OpenSim/Grid/GridServer/Program.cs
+++ b/OpenSim/Grid/GridServer/Program.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using log4net.Config; 28using log4net.Config;
29using Nini.Config;
29 30
30namespace OpenSim.Grid.GridServer 31namespace OpenSim.Grid.GridServer
31{ 32{
@@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer
33 { 34 {
34 public static void Main(string[] args) 35 public static void Main(string[] args)
35 { 36 {
37 ArgvConfigSource argvSource = new ArgvConfigSource(args);
38 argvSource.AddSwitch("Startup", "console", "c");
39
36 XmlConfigurator.Configure(); 40 XmlConfigurator.Configure();
37 41
38 GridServerBase app = new GridServerBase(); 42 GridServerBase app = new GridServerBase();
39 43
44 IConfig startupConfig = argvSource.Configs["Startup"];
45 if (startupConfig != null)
46 {
47 app.m_consoleType = startupConfig.GetString("console", "local");
48 }
49
50 app.m_configSource = argvSource;
51
40// if (args.Length > 0 && args[0] == "-setuponly") 52// if (args.Length > 0 && args[0] == "-setuponly")
41// { 53// {
42// app.Config(); 54// app.Config();
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index dcefeea..654e770 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Nini.Config;
33using log4net.Config; 34using log4net.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -56,8 +57,22 @@ namespace OpenSim.Grid.MessagingServer
56 57
57 // private UUID m_lastCreatedUser = UUID.Random(); 58 // private UUID m_lastCreatedUser = UUID.Random();
58 59
60 protected static string m_consoleType = "local";
61 protected static IConfigSource m_config = null;
62
59 public static void Main(string[] args) 63 public static void Main(string[] args)
60 { 64 {
65 ArgvConfigSource argvSource = new ArgvConfigSource(args);
66 argvSource.AddSwitch("Startup", "console", "c");
67
68 IConfig startupConfig = argvSource.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_consoleType = startupConfig.GetString("console", "local");
72 }
73
74 m_config = argvSource;
75
61 XmlConfigurator.Configure(); 76 XmlConfigurator.Configure();
62 77
63 m_log.Info("[SERVER]: Launching MessagingServer..."); 78 m_log.Info("[SERVER]: Launching MessagingServer...");
@@ -70,7 +85,18 @@ namespace OpenSim.Grid.MessagingServer
70 85
71 public OpenMessage_Main() 86 public OpenMessage_Main()
72 { 87 {
73 m_console = new LocalConsole("Messaging"); 88 switch (m_consoleType)
89 {
90 case "rest":
91 m_console = new RemoteConsole("Messaging");
92 break;
93 case "basic":
94 m_console = new CommandConsole("Messaging");
95 break;
96 default:
97 m_console = new LocalConsole("Messaging");
98 break;
99 }
74 MainConsole.Instance = m_console; 100 MainConsole.Instance = m_console;
75 } 101 }
76 102
@@ -88,20 +114,33 @@ namespace OpenSim.Grid.MessagingServer
88 { 114 {
89 if (m_userServerModule.registerWithUserServer()) 115 if (m_userServerModule.registerWithUserServer())
90 { 116 {
91 m_log.Info("[SERVER]: Starting HTTP process"); 117 if (m_httpServer == null)
92 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 118 {
93 119 m_log.Info("[SERVER]: Starting HTTP process");
94 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 120 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
95 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 121
96 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk); 122 if (m_console is RemoteConsole)
97 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown); 123 {
98 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation); 124 RemoteConsole c = (RemoteConsole)m_console;
99 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving); 125 c.SetServer(m_httpServer);
100 126 IConfig netConfig = m_config.AddConfig("Network");
101 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup); 127 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
102 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown); 128 netConfig.Set("ConsolePass", Cfg.ConsolePass);
103 129 c.ReadConfig(m_config);
104 m_httpServer.Start(); 130 }
131
132 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
133 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
134 m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
135 m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
136 m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
137 m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
138
139 m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
140 m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);
141
142 m_httpServer.Start();
143 }
105 m_log.Info("[SERVER]: Userserver registration was successful"); 144 m_log.Info("[SERVER]: Userserver registration was successful");
106 } 145 }
107 else 146 else
@@ -114,12 +153,12 @@ namespace OpenSim.Grid.MessagingServer
114 private void deregisterFromUserServer() 153 private void deregisterFromUserServer()
115 { 154 {
116 m_userServerModule.deregisterWithUserServer(); 155 m_userServerModule.deregisterWithUserServer();
117 if (m_httpServer != null) 156// if (m_httpServer != null)
118 { 157// {
119 // try a completely fresh registration, with fresh handlers, too 158 // try a completely fresh registration, with fresh handlers, too
120 m_httpServer.Stop(); 159// m_httpServer.Stop();
121 m_httpServer = null; 160// m_httpServer = null;
122 } 161// }
123 m_console.Output("[SERVER]: Deregistered from userserver."); 162 m_console.Output("[SERVER]: Deregistered from userserver.");
124 } 163 }
125 164
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 86c2abb..1ee53ef 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics;
43using OpenSim.Grid.Communications.OGS1; 43using OpenSim.Grid.Communications.OGS1;
44using OpenSim.Grid.Framework; 44using OpenSim.Grid.Framework;
45using OpenSim.Grid.UserServer.Modules; 45using OpenSim.Grid.UserServer.Modules;
46using Nini.Config;
46 47
47namespace OpenSim.Grid.UserServer 48namespace OpenSim.Grid.UserServer
48{ 49{
@@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer
73 74
74 protected AvatarCreationModule m_appearanceModule; 75 protected AvatarCreationModule m_appearanceModule;
75 76
77 protected static string m_consoleType = "local";
78 protected static IConfigSource m_config = null;
79
76 public static void Main(string[] args) 80 public static void Main(string[] args)
77 { 81 {
82 ArgvConfigSource argvSource = new ArgvConfigSource(args);
83 argvSource.AddSwitch("Startup", "console", "c");
84
85 IConfig startupConfig = argvSource.Configs["Startup"];
86 if (startupConfig != null)
87 {
88 m_consoleType = startupConfig.GetString("console", "local");
89 }
90
91 m_config = argvSource;
92
78 XmlConfigurator.Configure(); 93 XmlConfigurator.Configure();
79 94
80 m_log.Info("Launching UserServer..."); 95 m_log.Info("Launching UserServer...");
@@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer
87 102
88 public OpenUser_Main() 103 public OpenUser_Main()
89 { 104 {
90 m_console = new LocalConsole("User"); 105 switch (m_consoleType)
106 {
107 case "rest":
108 m_console = new RemoteConsole("User");
109 break;
110 case "basic":
111 m_console = new CommandConsole("User");
112 break;
113 default:
114 m_console = new LocalConsole("User");
115 break;
116 }
91 MainConsole.Instance = m_console; 117 MainConsole.Instance = m_console;
92 } 118 }
93 119
@@ -129,6 +155,16 @@ namespace OpenSim.Grid.UserServer
129 155
130 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 156 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
131 157
158 if (m_console is RemoteConsole)
159 {
160 RemoteConsole c = (RemoteConsole)m_console;
161 c.SetServer(m_httpServer);
162 IConfig netConfig = m_config.AddConfig("Network");
163 netConfig.Set("ConsoleUser", Cfg.ConsoleUser);
164 netConfig.Set("ConsolePass", Cfg.ConsolePass);
165 c.ReadConfig(m_config);
166 }
167
132 RegisterInterface<CommandConsole>(m_console); 168 RegisterInterface<CommandConsole>(m_console);
133 RegisterInterface<UserConfig>(Cfg); 169 RegisterInterface<UserConfig>(Cfg);
134 170
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2dbbf70..4e665e9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,6 +1978,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part )
1982 {
1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1991 q = avatar.CameraRotation; // Mouselook
1992 else
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1994 else
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1996 }
1997 else
1998 q = part.ParentGroup.GroupRotation; // just the group rotation
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 }
2001 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2003 }
2004
1981 public LSL_Rotation llGetLocalRot() 2005 public LSL_Rotation llGetLocalRot()
1982 { 2006 {
1983 m_host.AddScriptLPS(1); 2007 m_host.AddScriptLPS(1);
@@ -7299,7 +7323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7299 break; 7323 break;
7300 7324
7301 case (int)ScriptBaseClass.PRIM_ROTATION: 7325 case (int)ScriptBaseClass.PRIM_ROTATION:
7302 res.Add(llGetRot()); 7326 res.Add(GetPartRot(part));
7303 break; 7327 break;
7304 7328
7305 case (int)ScriptBaseClass.PRIM_TYPE: 7329 case (int)ScriptBaseClass.PRIM_TYPE:
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}
diff --git a/prebuild.xml b/prebuild.xml
index 5e44169..ebe5c62 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -911,6 +911,7 @@
911 <Reference name="OpenMetaverse.dll"/> 911 <Reference name="OpenMetaverse.dll"/>
912 <Reference name="XMLRPC.dll"/> 912 <Reference name="XMLRPC.dll"/>
913 <Reference name="log4net.dll"/> 913 <Reference name="log4net.dll"/>
914 <Reference name="Nini.dll"/>
914 915
915 <Files> 916 <Files>
916 <Match pattern="*.cs" recurse="true"/> 917 <Match pattern="*.cs" recurse="true"/>
@@ -1178,6 +1179,7 @@
1178 <Reference name="OpenMetaverse.StructuredData.dll"/> 1179 <Reference name="OpenMetaverse.StructuredData.dll"/>
1179 <Reference name="XMLRPC.dll"/> 1180 <Reference name="XMLRPC.dll"/>
1180 <Reference name="log4net.dll"/> 1181 <Reference name="log4net.dll"/>
1182 <Reference name="Nini.dll"/>
1181 <Reference name="DotNetOpenId.dll"/> 1183 <Reference name="DotNetOpenId.dll"/>
1182 1184
1183 <Files> 1185 <Files>
@@ -1279,6 +1281,7 @@
1279 <Reference name="OpenMetaverse.dll"/> 1281 <Reference name="OpenMetaverse.dll"/>
1280 <Reference name="XMLRPC.dll"/> 1282 <Reference name="XMLRPC.dll"/>
1281 <Reference name="log4net.dll"/> 1283 <Reference name="log4net.dll"/>
1284 <Reference name="Nini.dll"/>
1282 1285
1283 <Files> 1286 <Files>
1284 <Match pattern="*.cs" recurse="true"/> 1287 <Match pattern="*.cs" recurse="true"/>