From 0b2934a1b1e34b7f7a33720a1f6a7852b0d1a6fe Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 30 Nov 2007 15:10:47 +0000 Subject: added support for a console command script to be ran every 20 minutes (will make that time changable in a future commit), to use add a entry under the Startup section of opensim.ini , with: timer_Script = "" (the filename being the console "script" you want to be ran every 20 minutes). This hasn't been tested very much so.. --- OpenSim/Region/Application/OpenSimMain.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 4ebe207..51a647d 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -86,6 +86,9 @@ namespace OpenSim private string m_assetStorage = "sqlite"; + private string m_timedScript = "disabled"; + private System.Timers.Timer m_scriptTimer; + public ConsoleCommand CreateAccount = null; private bool m_dumpAssetsToFile; @@ -236,6 +239,8 @@ namespace OpenSim m_scriptEngine = startupConfig.GetString("script_engine", "DotNetEngine"); m_assetStorage = startupConfig.GetString("asset_database", "sqlite"); + + m_timedScript = startupConfig.GetString("timer_Script", "disabled"); } IConfig standaloneConfig = m_config.Configs["StandAlone"]; @@ -339,6 +344,14 @@ namespace OpenSim MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); + + if (m_timedScript != "disabled") + { + m_scriptTimer = new System.Timers.Timer(); + m_scriptTimer.Enabled = true; + m_scriptTimer.Interval = (int)(1200 * 1000); + m_scriptTimer.Elapsed += new System.Timers.ElapsedEventHandler(RunAutoTimerScript); + } } public UDPServer CreateRegion(RegionInfo regionInfo) @@ -523,6 +536,13 @@ namespace OpenSim Environment.Exit(0); } + private void RunAutoTimerScript(object sender, EventArgs e) + { + if (m_timedScript != "disabled") + { + RunCommandScript(m_timedScript); + } + } #region Console Commands /// -- cgit v1.1