diff options
author | Tom Grimshaw | 2010-07-01 08:49:53 -0700 |
---|---|---|
committer | Tom Grimshaw | 2010-07-01 08:49:53 -0700 |
commit | 4851706d35ca0e24e0f69348d957145631a8d94c (patch) | |
tree | ad984517af1449c717a387d5a07eca0ec2285f93 /OpenSim/Server/Base/ServicesServerBase.cs | |
parent | Catch newid == null which is what happens if the asset service is offline (se... (diff) | |
parent | Avoid a spurious error message when taking a friend's no copy item (diff) | |
download | opensim-SC-4851706d35ca0e24e0f69348d957145631a8d94c.zip opensim-SC-4851706d35ca0e24e0f69348d957145631a8d94c.tar.gz opensim-SC-4851706d35ca0e24e0f69348d957145631a8d94c.tar.bz2 opensim-SC-4851706d35ca0e24e0f69348d957145631a8d94c.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Server/Base/ServicesServerBase.cs')
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index a5bebb8..dee31bd 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -230,6 +230,12 @@ namespace OpenSim.Server.Base | |||
230 | "shutdown", | 230 | "shutdown", |
231 | "Quit the application", HandleQuit); | 231 | "Quit the application", HandleQuit); |
232 | 232 | ||
233 | // Register a command to read other commands from a file | ||
234 | MainConsole.Instance.Commands.AddCommand("base", false, "command-script", | ||
235 | "command-script <script>", | ||
236 | "Run a command script from file", HandleScript); | ||
237 | |||
238 | |||
233 | // Allow derived classes to perform initialization that | 239 | // Allow derived classes to perform initialization that |
234 | // needs to be done after the console has opened | 240 | // needs to be done after the console has opened |
235 | // | 241 | // |
@@ -259,6 +265,41 @@ namespace OpenSim.Server.Base | |||
259 | m_log.Info("[CONSOLE] Quitting"); | 265 | m_log.Info("[CONSOLE] Quitting"); |
260 | } | 266 | } |
261 | 267 | ||
268 | protected virtual void HandleScript(string module, string[] parms) | ||
269 | { | ||
270 | if (parms.Length != 2) | ||
271 | { | ||
272 | return; | ||
273 | } | ||
274 | RunCommandScript(parms[1]); | ||
275 | } | ||
276 | |||
277 | /// <summary> | ||
278 | /// Run an optional startup list of commands | ||
279 | /// </summary> | ||
280 | /// <param name="fileName"></param> | ||
281 | private void RunCommandScript(string fileName) | ||
282 | { | ||
283 | if (File.Exists(fileName)) | ||
284 | { | ||
285 | m_log.Info("[COMMANDFILE]: Running " + fileName); | ||
286 | |||
287 | using (StreamReader readFile = File.OpenText(fileName)) | ||
288 | { | ||
289 | string currentCommand; | ||
290 | while ((currentCommand = readFile.ReadLine()) != null) | ||
291 | { | ||
292 | if (currentCommand != String.Empty) | ||
293 | { | ||
294 | m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'"); | ||
295 | MainConsole.Instance.RunCommand(currentCommand); | ||
296 | } | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | |||
302 | |||
262 | protected virtual void ReadConfig() | 303 | protected virtual void ReadConfig() |
263 | { | 304 | { |
264 | } | 305 | } |