From 763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 29 Apr 2008 14:50:27 +0000 Subject: From: Dr Scofield * Fixes the admin_shutdown xmlrpc method * Adds a share/python/console/shutdown.py script for shutting down a background OpenSim * For more details see http://xyzzyxyzzy.net/2008/04/29/console-less-opensim/ * There should also be instructions in the opensimulator wiki soon as well --- .../RemoteController/RemoteAdminPlugin.cs | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'OpenSim/ApplicationPlugins/RemoteController') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 2cb5375..fed7d9b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -218,9 +218,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions Hashtable responseData = new Hashtable(); try { - checkStringParameters(request, new string[] { "password", "shutdown" }); - checkIntegerParams(request, new string[] { "milliseconds"}); - if (requiredPassword != String.Empty && (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) throw new Exception("wrong password"); @@ -228,28 +225,28 @@ namespace OpenSim.ApplicationPlugins.LoadRegions responseData["accepted"] = "true"; response.Value = responseData; - if ((string) requestData["shutdown"] == "delayed") + int timeout = 2000; + + if (requestData.ContainsKey("shutdown") && + ((string) requestData["shutdown"] == "delayed") && + requestData.ContainsKey("milliseconds")) { - int timeout = (Int32) requestData["milliseconds"]; + timeout = (Int32) requestData["milliseconds"]; m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + " second(s). Please save what you are doing and log out."); - - // Perform shutdown - Timer shutdownTimer = new Timer(timeout); // Wait before firing - shutdownTimer.AutoReset = false; - shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); - shutdownTimer.Start(); } else { m_app.SceneManager.SendGeneralMessage("Region is going down now."); - - // Perform shutdown - Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing - shutdownTimer.AutoReset = false; - shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); - shutdownTimer.Start(); } + + // Perform shutdown + Timer shutdownTimer = new Timer(timeout); // Wait before firing + shutdownTimer.AutoReset = false; + shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); + shutdownTimer.Start(); + + responseData["success"] = "true"; } catch (Exception e) { -- cgit v1.1