osgrid.org
https://forums.osgrid.org/

REFERENCE: Region Ready - Responder Script (OpenSim SYSOP)
https://forums.osgrid.org/viewtopic.php?f=5&t=2863
Page 1 of 1

Author:  WhiteStar Magic [ Sun Oct 24, 2010 10:14 am ]
Post subject:  REFERENCE: Region Ready - Responder Script (OpenSim SYSOP)

This is for OpenSimulator SYSTEM OPERATORS.

Purpose of this:
To prevent logins to a region set (opensim instance) while it is still in Startup and loading scripts etc... which are known issues and often will crash the instance when people login to it while it is still starting up. This waits till everything is started and ready, then it enables Logins and people can enjoy the regions without crashing it while it's starting up.

What is Region Ready ?
This is a Notification that is sent to OpenSim Regions on channel -800 by the OpenSim when it starts up to notify that it has completed and is ready. When this is used in combination with StartDisabled = true it will prevent logins till RegionReady is signalled by OpenSim. Look in OpenSim.ini under the ; ## SYSTEM Section for StartDisabled = false and change that to true.

Usage:
Place the script in a prim on the region you wish to be the "control region" and when it hears the RegionReady signal it will then excecute the console commands.
You MUST enable the osConsoleCommand function in your OpenSim.ini and make certain that you place YOUR OWN UUID in there to prevent anyone else from using osConsoleCommand. Refer to http://opensimulator.org/wiki/OSSL_Enabling_Functions
Pro-Tip: After Enabling RegionReady. When you Start OpenSim up, watch your OPENSIM CONSOLE as it loads, when it is finally done loading all the scripts, you will see a message like this appear on console as shown below. The Last Region that is completed will give this message, so if you wish to wait till All Regions in a set are loaded, then place the Prim Containing the Script in the LAST REGION that is fully loaded. (that will usually be the region with the most scripts)

Console Message Example
{L_CODE}:
INFO  - OpenSim.Region.OptionalModules.Scripting.RegionReady.RegionReadyModule [RegionReady]: Region "REGION NAME" is ready: "server_startup,1,1," on channel -800


RegionReady - Responder Script
{L_CODE}:
// REGION-READY Responder Script
// ===================================================================================
// Tested & Operational on OpenSim 0.7.1 Dev 80f9022-r/14257 (interface version 6)
// Date: October.23.2010
// Created by WhiteStar Magic
// Version: 1.1b
//
// Use & share happily with anyone that could use it.
// WTFPL - Do What The Fuck You Want To Public License
// http://sam.zoy.org/wtfpl/
// ===================================================================================
// FUNCTION:
//  This listens on channel -800 for the region ready console command to come in
//  When it hears the region Ready it sends commands to the Console.
//
// REQUIREMENTS:
// In OpenSim.ini
//   in ### SYSTEM section
//   StartDisabled = true          Just Above [SMTP]
//
// [RegionReady]
//     enabled = true
//     channel_notify = -800
//
// [XEngine]
//   Allow_osConsoleCommand=UUID   See http://opensimulator.org/wiki/OSSL_Enabling_Functions
// ===================================================================================
//
string regionname;        // for This Scripts Home Region Name
integer NotifyMe = TRUE;  // set to FALSE to not get Region Start Notification IM
integer listen_handle;    // to allow for unloading the listener.  Cannot be unloaded from listen event, so done in touch event.

default
{
    on_rez(integer param)
    {
        llResetScript();
    }
   
    state_entry()
    {
        regionname = llGetRegionName();
        listen_handle = llListen(-800, "", "", "");
    }
   
    listen( integer channel, string name, key id, string message )
    {
        string currtime = (string)llGetTimestamp();
        llSetObjectDesc("RegionReady Heard @ "+currtime);
        osConsoleCommand("login enable");
        osConsoleCommand("login status");
        osConsoleCommand("monitor report"); // OPTIONAL gives post start stats of instance
        if(NotifyMe) llInstantMessage(llGetOwner(),"Region Ready Processed on "+regionname+" @ "+currtime+" UTC");
    }
   
    touch_end(integer num_detected)
    {
        if(llDetectedKey(0)==llGetOwner())
        {
            llOwnerSay(llGetObjectDesc()+" - "+(string)llGetTimestamp());
            llListenRemove(listen_handle);
        }
    }
   
    changed(integer mask)
    {
        // The 1024 Bit needs to be checked so the listen_handle is refreshed on region restart
        // same bitmask for CHANGED_REGION_RESTART = 1024; CHANGED_REGION_START = 1024; //LL Changed the constant from CHANGED_REGION_RESTART
        if(mask & 1024)
        {
            llResetScript();
        }
    }
}

Author:  WhiteStar Magic [ Tue Oct 26, 2010 12:38 pm ]
Post subject:  Re: REFERENCE: Region Ready - Responder Script (OpenSim SYSOP)

The Above has been Tested on Windows 7, Win Server 2003 & 2008, UBUNTU 10 & Centos 5.3

In Console you should see messages similar to this extract from the Console Display.
NOTE: osConsoleCommand does not display the command issued on OpenSim Console by an in-world script.

{L_CODE}:
[RegionReady]: Region "FirstStar_Station" is ready: "server_startup,1,1," on channel -800

Enabling logins for region FirstStar_SW
Enabling logins for region FirstStar_W
Enabling logins for region FirstStar_NW
Enabling logins for region FirstStar_S
Enabling logins for region FirstStar_Station
Enabling logins for region FirstStar_N
Enabling logins for region FirstStar_SE
Enabling logins for region FirstStar_E
Enabling logins for region FirstStar_NE
Login in FirstStar_SW are enabled
Login in FirstStar_W are enabled
Login in FirstStar_NW are enabled
Login in FirstStar_S are enabled
Login in FirstStar_Station are enabled
Login in FirstStar_N are enabled
Login in FirstStar_SE are enabled
Login in FirstStar_E are enabled
Login in FirstStar_NE are enabled
13:33:45 - [MonitorModule]: FirstStar_SW reports Root Agent Count = 0 agent(s)
---- and much more -- cut for brevity ---

Author:  Bo Iwu [ Sun Nov 28, 2010 1:41 am ]
Post subject:  Re: REFERENCE: Region Ready - Responder Script (OpenSim SYSOP)

Very cool feature, thank you :D

Author:  WhiteStar Magic [ Mon Apr 29, 2013 9:43 pm ]
Post subject:  Re: REFERENCE: Region Ready - Responder Script (OpenSim SYSOP)

PLEASE UNSTICKY THIS ASAP and Any other Stickied Posting by myself

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/