Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AUTO OS OAR BackUP
#1
Hi all, i use this script to save / backup my OS - regions automatically on my server in OAR format. 
Just put the script in a prim. it will backup Your sim ( one for each sim ) every day ( depends of timer setup ) 

hope You find some good ideas !
!! only for OpenSim !!

// ----- script start here ---------------------------------------------------------------------------

//***** Backups the current region to OAR ********
//   - Current script may be activated by the prim owner 
//   - Requires OSSL functions treat level set to "Severe"

// —>  put this script in a prim located on the sim You will save every day with OAR

string OAR_FILE_EXT= ".oar"; 

// setup Backup folder   ->>  sure; here You can optimize if You want
   //step 1
   string Backup_Folder = "C:";  // change to Your Backup folder
   // step 2: You need to change " Backup Folder/" in script ( two times )   fe.: "C:/OS/meine sims/"   <<- exactly this format
            
string source = "";

// FALSE will generate unique archive name ( based on the current time:  [regionname][datetime].[OAR_FILE_EXT])
// TRUE will overwrite the last arhcive (filename: [regionname].[OAR_FILE_EXT]

integer OVERWRITE_OLD_OARS = FALSE;

default
{
    state_entry()
    {
      llSetTimerEvent(86400);    //  one day
      llSay(0,"Server ready for Region " + llGetRegionName());      
    }
    
    touch_start(integer num)
    {       
        
        if(llDetectedKey(0)==llGetOwner())
        {
            
          llSay(0, "perform backup for Region " + llGetRegionName());
          string regionName = llGetRegionName();          
          llOwnerSay("Archiving region "+regionName);    
          
          integer res_Allert = osConsoleCommand("alert Backup for  "+ regionName + " in progress...");
          llSleep(2);
          integer res = osConsoleCommand("change region "+ regionName);
          if(res==FALSE)
          {
            llOwnerSay("Unable to execute command 'change region'");
          }
         
          string oarName = regionName+OAR_FILE_EXT;
          if(OVERWRITE_OLD_OARS==FALSE)         
          {
              string time = llGetTimestamp();
              list l = llParseString2List(time,":","");
              oarName = regionName + "-" + llList2String(l,0)+llList2String(l,1)+OAR_FILE_EXT;
          }
                    
                string source = oarName;
                string pattern = " ";
                string replace = "_";
          
                    while (llSubStringIndex(source, pattern) > -1) {
                    integer len = llStringLength(pattern);
                    integer pos = llSubStringIndex(source, pattern);
                    if (llStringLength(source) == len) { source = replace; }
                    else if (pos == 0) { source = replace+llGetSubString(source, pos+len, -1); }
                    else if (pos == llStringLength(source)-len) { source = llGetSubString(source, 0, pos-1)+replace; }
                    else { source = llGetSubString(source, 0, pos-1)+replace+llGetSubString(source, pos+len, -1); }
         }
          
          res = osConsoleCommand("save oar " + " Backup Folder/" + source);
          if(res==FALSE)
          {
            llOwnerSay("Unable to execute command 'save oar'");
          }         
         
        }
        else
        {
            llSay(0,"Access denied!");
        }
            
        
        llResetScript();
    }
        
    timer()
        {
            
        llSay(0, "perform backup for Region " + llGetRegionName());
        string regionName = llGetRegionName();           
          
          integer res_Allert = osConsoleCommand("alert Backup for  "+regionName + " in progress...");
          llSleep(2);
          integer res = osConsoleCommand("change region "+regionName);
          if(res==FALSE)
          {
            llOwnerSay("Unable to execute command 'change region'");
          }
         
          string oarName = regionName+OAR_FILE_EXT;
          if(OVERWRITE_OLD_OARS==FALSE)         
          {
              string time = llGetTimestamp();
              list l = llParseString2List(time,":","");
              oarName= regionName+"-"+llList2String(l,0)+llList2String(l,1)+OAR_FILE_EXT;
          }
                    
                string source = oarName;
                string pattern = " ";
                string replace = "_";
          
                    while (llSubStringIndex(source, pattern) > -1) {
                    integer len = llStringLength(pattern);
                    integer pos = llSubStringIndex(source, pattern);
                    if (llStringLength(source) == len) { source = replace; }
                    else if (pos == 0) { source = replace+llGetSubString(source, pos+len, -1); }
                    else if (pos == llStringLength(source)-len) { source = llGetSubString(source, 0, pos-1)+replace; }
                    else { source = llGetSubString(source, 0, pos-1)+replace+llGetSubString(source, pos+len, -1); }
         }
          
          res = osConsoleCommand("save oar " + " Backup Folder/„ + source);
          if(res==FALSE)
          {
            llOwnerSay("Unable to execute command 'save oar'");
          }    
            
        }       
}
Reply
#2
source ? or did you make this yourself? 

moving thread to Alternative grids. | shares
Guests cannot see links in the messages. Please register to forum by clicking here to see links. | Guests cannot see links in the messages. Please register to forum by clicking here to see links.| Guests cannot see links in the messages. Please register to forum by clicking here to see links. | Guests cannot see links in the messages. Please register to forum by clicking here to see links.
Reply
#3
Using command prompt windows to issue various opensim commands is inconvenient, so I want to use menus and forms in a viewer to submit some these commands.  While trying to find a way to do this, I had forgotten about the osConsoleCommand that is used in your "Auto OS OAR Backup" script.  Now, I realize I should be able to add a general purpose osConsoleCommand to an avatar attachment similar to the Firestorm bridge and use it to issue console commands from a viewer.  I always enjoy getting new ideas from reading posts in this forum.
Reply




Users browsing this thread: 1 Guest(s)