Backing Up WIN
From OpenSimulator
Dene Sparta (Talk | contribs) m (In FullBackup.bat, replaced %OS_Instance%\BACKup%\DBsql\%DBNAME%_%TIMESTAMP%.sql with %OSbackup%\DBsql\%DBNAME%_%TIMESTAMP%.sql) |
(housekeeping & update) |
||
Line 15: | Line 15: | ||
You can copy these command scripts provided into your \BIN Folder. | You can copy these command scripts provided into your \BIN Folder. | ||
− | '''Highly Recomended:'''<br>This System is designed to operated with the following SubStructures to isolate your Backups for Easy Retrieval and archiving.<br><br>'''SINGLE INSTANCE OF OPENSIM<br>''' | + | '''Highly Recomended:'''<br>This System is designed to operated with the following SubStructures to isolate your Backups for Easy Retrieval and archiving.<br><br>'''SINGLE INSTANCE OF OPENSIM<br>''' |
− | <blockquote>c:\OpenSim <---- Base installation<br>c:\OpenSim\bin <---- the bin Folder<br>c:\OpenSim\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders<br>c:\OpenSim\BACKups\DB <---- for SqlLite Databases<br>c:\OpenSim\BACKups\DBsql <---- for MySql Databases<br>c:\OpenSim\BACKups\EXPORTS <---- ExportDirectories transfered here<br>c:\OpenSim\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories<br>c:\OpenSim\BACKups\LOGS <---- Log Files Archived Here for Review<br>c:\OpenSim\BACKups\OAR <---- for OAR Files<br>c:\OpenSim\BACKups\REGIONS <---- Region.XML or INI files copied here<br>c:\OpenSim\BACKups\TERRAINS <---- for r32 Terrain Files<br>c:\OpenSim\BACKups\TXT <---- TXT files used for console scripts copied here<br>c:\OpenSim\BACKups\XML2 <---- for XML2 Files </blockquote> | + | <blockquote>c:\OpenSim <---- Base installation<br>c:\OpenSim\bin <---- the bin Folder<br>c:\OpenSim\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders<br>c:\OpenSim\BACKups\DB <---- for SqlLite Databases<br>c:\OpenSim\BACKups\DBsql <---- for MySql Databases<br>c:\OpenSim\BACKups\EXPORTS <---- ExportDirectories transfered here<br>c:\OpenSim\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories<br>c:\OpenSim\BACKups\LOGS <---- Log Files Archived Here for Review<br>c:\OpenSim\BACKups\OAR <---- for OAR Files<br>c:\OpenSim\BACKups\REGIONS <---- Region.XML or INI files copied here<br>c:\OpenSim\BACKups\TERRAINS <---- for r32 Terrain Files<br>c:\OpenSim\BACKups\TXT <---- TXT files used for console scripts copied here<br>c:\OpenSim\BACKups\XML2 <---- for XML2 Files </blockquote> |
Note that EXPORTS are saved in \bin\exports by default, as defined in the OpenSim.ini | Note that EXPORTS are saved in \bin\exports by default, as defined in the OpenSim.ini | ||
− | '''IF YOU HAVE MULTIPLE INSTANCES, CHANGE PATHING ACCORDINGLY<br>''' | + | '''IF YOU HAVE MULTIPLE INSTANCES, CHANGE PATHING ACCORDINGLY<br>''' |
− | <blockquote>C:\OpenSim\INSTANCEa <---- Base installation<br>C:\OpenSim\INSTANCEa\bin <---- the bin Folder<br>C:\OpenSim\INSTANCEa\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders<br>C:\OpenSim\INSTANCEa\BACKups\DB <---- for SqlLite Databases<br>C:\OpenSim\INSTANCEa\BACKups\DBsql <---- for MySql Databases<br>C:\OpenSim\INSTANCEa\BACKups\EXPORTS <---- ExportDirectories transfered here<br>C:\OpenSim\INSTANCEa\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories<br>C:\OpenSim\INSTANCEa\BACKups\LOGS <---- Log Files Archived Here for Review<br>C:\OpenSim\INSTANCEa\BACKups\OAR <---- for OAR Files<br>C:\OpenSim\INSTANCEa\BACKups\REGIONS <---- Region.XML or INI files copied here<br>C:\OpenSim\INSTANCEa\BACKups\TERRAINS <---- for r32 Terrain Files<br>C:\OpenSim\INSTANCEa\BACKups\TXT <---- TXT files used for console scripts copied here<br>C:\OpenSim\INSTANCEa\BACKups\XML2 <---- for XML2 Files </blockquote> | + | <blockquote>C:\OpenSim\INSTANCEa <---- Base installation<br>C:\OpenSim\INSTANCEa\bin <---- the bin Folder<br>C:\OpenSim\INSTANCEa\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders<br>C:\OpenSim\INSTANCEa\BACKups\DB <---- for SqlLite Databases<br>C:\OpenSim\INSTANCEa\BACKups\DBsql <---- for MySql Databases<br>C:\OpenSim\INSTANCEa\BACKups\EXPORTS <---- ExportDirectories transfered here<br>C:\OpenSim\INSTANCEa\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories<br>C:\OpenSim\INSTANCEa\BACKups\LOGS <---- Log Files Archived Here for Review<br>C:\OpenSim\INSTANCEa\BACKups\OAR <---- for OAR Files<br>C:\OpenSim\INSTANCEa\BACKups\REGIONS <---- Region.XML or INI files copied here<br>C:\OpenSim\INSTANCEa\BACKups\TERRAINS <---- for r32 Terrain Files<br>C:\OpenSim\INSTANCEa\BACKups\TXT <---- TXT files used for console scripts copied here<br>C:\OpenSim\INSTANCEa\BACKups\XML2 <---- for XML2 Files </blockquote> |
'''SPECIAL NOTE!<br>'''The PRESTART Batch File in [[Smart Prestart WIN|Smart_Prestart_WIN]] will autobuild these structures & Perform several important functions | '''SPECIAL NOTE!<br>'''The PRESTART Batch File in [[Smart Prestart WIN|Smart_Prestart_WIN]] will autobuild these structures & Perform several important functions | ||
Line 26: | Line 26: | ||
'''CONSOLE SCRIPT "BACKUP.TXT"''' | '''CONSOLE SCRIPT "BACKUP.TXT"''' | ||
− | <blockquote><br>; Description: of BACKUP.TXT | + | <blockquote><br></blockquote><source lang="text">; Description: of BACKUP.TXT |
+ | ; Creates a Full System Backup of all critical data | ||
+ | ; Uses Command Console Functions not available otherwise | ||
+ | ; | ||
+ | ; Creates OAR, XML2, R32 (Region Terrain Files), and places them into the predefined folder structure. | ||
+ | ; Modify the folder structure according to your installation | ||
+ | ; | ||
+ | ; NOTE The Export goes to the default as defined in opensim.ini it is NOT SUGGESTED that this be changed | ||
+ | ; | ||
+ | ; EXAMPLE is provided for a multi-region install. If you only have one region , or more adjust accordingly | ||
+ | ; RENAME Region1, Region2 etc ... according to your region names | ||
+ | ; | ||
+ | ; OAR FILES ! They do take a while depending on the volume of data on the region. The script will proceed | ||
+ | ; and the commands will be queued and processed. IF you watch the destination folder, you will see teh OAR files grow | ||
+ | ; as they are being written out to the hard drive. Be Patient if you have a large installation. | ||
+ | ; This will imapct system response to those In-World on the region being processed! | ||
+ | ; | ||
+ | change region root | ||
+ | backup | ||
+ | export save-all | ||
+ | ; | ||
+ | change region Region1 | ||
+ | terrain save c:\OpenSim\BACKups\TERRAINS\Region1.r32 | ||
+ | save xml2 c:\OpenSim\BACKups\XML2\Region1.xml | ||
+ | save oar c:\OpenSim\BACKups\OAR\Region1.oar | ||
+ | ; | ||
+ | change region Region2 | ||
+ | terrain save c:\OpenSim\BACKups\TERRAINS\Region2.r32 | ||
+ | save xml2 c:\OpenSim\BACKups\XML2\Region2.xml | ||
+ | save oar c:\OpenSim\BACKups\OAR\Region2.oar | ||
+ | ; | ||
+ | ; REPEAT AS NECESSARY, edit "Region#" and change it to YOUR REGION NAME</source> | ||
<br>'''RESTORATION:<br>'''To Run this script, type the following in your console IF RESTORE.TXT is saved in your \bin folder. <br>'''command-script restore.txt''' | <br>'''RESTORATION:<br>'''To Run this script, type the following in your console IF RESTORE.TXT is saved in your \bin folder. <br>'''command-script restore.txt''' | ||
'''CONSOLE SCRIPT "RESTORE.TXT"''' | '''CONSOLE SCRIPT "RESTORE.TXT"''' | ||
− | <blockquote><br>; FULL RESTORE PROCESS for OPENSIM CONSOLE | + | <blockquote><br></blockquote><source lang="text">; FULL RESTORE PROCESS for OPENSIM CONSOLE |
+ | ; Description: | ||
+ | ; Uses Command Console Functions not available otherwise | ||
+ | ; | ||
+ | ; RESTORES OAR, R32 (Region Terrain Files), and places them into the Original Regions | ||
+ | ; from the Backup\Folder structures as previously defined | ||
+ | ; CAN be used to restore XML2 but commented out, there as last resort, IF needed | ||
+ | ; | ||
+ | ; EXAMPLE is provided for a multi-Region install. If you only have one Region , or more adjust accordingly | ||
+ | ; RENAME Region1, Region2 etc ... according to your Region names | ||
+ | ; | ||
+ | ; OAR FILES ! They do take a while depending on the volume of data on the Region. The script will proceed | ||
+ | ; and the commands will be queued and processed. | ||
+ | ; | ||
+ | change region Region1 | ||
+ | terrain load c:\OpenSim\BACKups\TERRAINS\Region1.r32 | ||
+ | load oar c:\OpenSim\BACKups\OAR\Region1.oar | ||
+ | ; load xml2 c:\OpenSim\BACKups\BACKups\XML2\Region1.xml | ||
+ | ; | ||
+ | change region Region2 | ||
+ | terrain load c:\OpenSim\BACKups\TERRAINS\Region2.r32 | ||
+ | load oar c:\OpenSim\BACKups\OAR\Region2.oar | ||
+ | ; load xml2 c:\OpenSim\BACKups\XML2\Region2.xml | ||
+ | ; | ||
+ | ; REPEAT AS NECESSARY, edit "Region#" and change it to YOUR REGION NAME | ||
+ | ; | ||
+ | ; you will see messages on the console as it completes the queued tasks | ||
+ | ;</source> | ||
<br> | <br> | ||
'''BATCH File Name: FullBackup.bat<br>Command to execute:''' Run in command prompt OR Task Scheduler (see references at bottom of page)<br>'''Description:''' Copies opensim SQL database out & Everything else Important<br>'''CAVEATS:''' none known<br>'''LOCATION:''' Place in folder with other Batch CMD files @ '''C:\OpenSim\InstanceA '''Where InstanceA is the directory ABOVE '''C:\OpenSim\InstanceA\bin'''<br>'''DEPENDENCIES:''' Use the Posted Console command-script following this, They work together! | '''BATCH File Name: FullBackup.bat<br>Command to execute:''' Run in command prompt OR Task Scheduler (see references at bottom of page)<br>'''Description:''' Copies opensim SQL database out & Everything else Important<br>'''CAVEATS:''' none known<br>'''LOCATION:''' Place in folder with other Batch CMD files @ '''C:\OpenSim\InstanceA '''Where InstanceA is the directory ABOVE '''C:\OpenSim\InstanceA\bin'''<br>'''DEPENDENCIES:''' Use the Posted Console command-script following this, They work together! | ||
− | <blockquote><br>@echo off | + | <blockquote><br></blockquote><source lang="text">@echo off |
+ | :: FILENAME: FullBackup.bat | ||
+ | :: AUTHOR: WhiteStar Magic @ OSGrid | ||
+ | :: DATE: REVISED Nov-24-2010 | ||
+ | :: | ||
+ | :: Operational Under Windows Vista SP1 TO Win Server 2008 R1 (64bit) | ||
+ | :: Suitable under other Windows Platforms, but not tested | ||
+ | :: | ||
+ | :: Added MySql Functions | ||
+ | :: Added Further Commenting to better explain what is being done | ||
+ | :: Added Additional Folder Backups (Exports complete) | ||
+ | :: Added INI & TXT File Backups as well, Accounting for Murphys Laws, (you never know) | ||
+ | :: Revised MAY.14.2009 | ||
+ | :: Correction added for TimeStamp to remove leading space from time IF time is < 12:00 (Operating System Quirk) | ||
+ | :: | ||
+ | :: Robocopy.exe can be downloaded from Microsoft Corp/MSDN Website. Search for it and get the latest version. | ||
+ | :: XP & Vista Users ! It works fine as long as you have the latest. | ||
+ | :: ROBOCOPY COMMANDS AS USED | ||
+ | :: SourceFolder TargetFolder FileName /S = DoSubFolders (non-empty) /LOG = Generate LOG of execution | ||
+ | :: | ||
+ | :: Place this batch file into Microsoft Scheduler, set to daily | ||
+ | :: Other scheduler systems can also be used if desired | ||
+ | :: ===================================================================================== | ||
+ | :: | ||
+ | :: CONFIGURING ENVIRONMENT PATHS AND SETUP TO SIMPLIFY CONFIG & ADMIN | ||
+ | :: Adjust the following to YOUR INSTALLED Folder Paths | ||
+ | :: | ||
+ | :: OSbackup = Where you want your Backup File Structure to be and send files to | ||
+ | :: OSbinSrc = Where the OpenSim Software is installed and run from | ||
+ | :: | ||
+ | SET OSbackup=C:\OPENSIM\InstanceA\BACKups | ||
+ | SET OSbinSrc=C:\OPENSIM\InstanceA\bin | ||
+ | :: | ||
+ | :: MYSQL INFORMATION TO BE FILLED OUT. IF DBUSER = XXX MySql Dump will not occur | ||
+ | set DBUSER=root | ||
+ | set DBPW=YOURPASSWORD | ||
+ | set DBNAME=opensim | ||
+ | :: | ||
+ | :: -------------------------------------------------------------------------------------- | ||
+ | :: DATE & TIME String Assembly | ||
+ | :: -------------------------------------------------------------------------------------- | ||
+ | :: Date & Time Format on your system | ||
+ | :: Check your format in command.prompt with DATE/T | ||
+ | :: | ||
+ | :: EU DATE FORMAT = 15-05-2006 DD-MM-YYYY | ||
+ | :: US DATE FORMAT = 05/17/2006 MM/DD/YYYY | ||
+ | :: TIME FORMAT 13:45:55 is truncated to 13-45 and colons are removed | ||
+ | :: DATES are cleaned of / or - or : depending on your system install & config. | ||
+ | :: | ||
+ | :: Parse Hour & Minutes Removing incorrect characters or leading spaces | ||
+ | :: i=HR, j=min, k=sec,l=msec | ||
+ | for /F "usebackq tokens=1,2,3,4 delims=/-:. " %%i in ('%TIME%') do set Ttime=%%i-%%j | ||
+ | :: | ||
+ | :: Parse the Date String removing unwated characters / or - or 'space' depends on system installation | ||
+ | for /F "usebackq tokens=1,2,3,4 delims=/-: " %%i in ('%DATE%') do set Tdate=%%i-%%j-%%k | ||
+ | :: | ||
+ | set TimeStamp=%Tdate%@%Ttime% | ||
+ | :: we now have a string which will appear as 24-11-2010@23-27 | ||
+ | :: | ||
+ | :: -------------------------------------------------------------------------------------- | ||
+ | :: Backup the MySQL DB from Live System | ||
+ | :: OpenSim Database Backup Section | ||
+ | :: -------------------------------------------------------------------------------------- | ||
+ | :: for more information on commands used: | ||
+ | :: Open a command shell (DOS Prompt / Console Session) | ||
+ | :: Go to the MySql Installation Folder | ||
+ | :: NOTE that the output can be reditected into a TXT file so that you can read it in a Text Editor | ||
+ | :: Type the Following commands for information at the command prompt | ||
+ | :: mysqldump -? | ||
+ | :: mysqlshow -? | ||
+ | :: to redirect out to TXT file do as shown: | ||
+ | :: mysqldump -? > %OSbackup%\MySqlDump_Commands.txt | ||
+ | :: mysqlshow -? > %OSbackup%\MySqlShow_Commands.txt | ||
+ | :: !!! Target Folder must exist. Adjust Paths according to YOUR installation !!! | ||
+ | :: ------------------------------------------------------------------------------------------------- | ||
+ | :: make folder if not exist | ||
+ | if not exist %OSbackup%\DBsql\*.* md %OSbackup%\DBsql | ||
+ | :: | ||
+ | :: generate MySql DB Backup | ||
+ | if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\%DBNAME%_%TIMESTAMP%.sql | ||
+ | :: | ||
+ | :: Dump the opensim table struct info for a snapshot of the stats | ||
+ | if DBUSER NEQ XXX mysqlshow -v -v -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\OS_db_STATS.txt | ||
+ | :: | ||
+ | :: ========================= | ||
+ | :: END OF MySql DB Backup Section | ||
+ | :: ========================= | ||
+ | :: | ||
+ | :: OPENSIM SYSTEM DATA BACKUP SECTION | ||
+ | :: ------------------------------------------------------------------------------------ | ||
+ | cd %OSbackup% | ||
+ | :: | ||
+ | :: if the folders do not exist, create them | ||
+ | :: | ||
+ | if not exist %OSbackup%\DB\*.* md %OSbackup%\DB | ||
+ | if not exist %OSbackup%\INI\*.* md %OSbackup%\INI | ||
+ | if not exist %OSbackup%\EXPORTS\*.* md %OSbackup%\EXPORTS | ||
+ | if not exist %OSbackup%\LOGS\*.* md %OSbackup%\LOGS | ||
+ | if not exist %OSbackup%\OAR\*.* md %OSbackup%\OAR | ||
+ | if not exist %OSbackup%\REGIONS\*.* md %OSbackup%\REGIONS | ||
+ | if not exist %OSbackup%\TERRAINS\*.* md %OSbackup%\TERRAINS | ||
+ | if not exist %OSbackup%\TXT\*.* md %OSbackup%\TXT | ||
+ | if not exist %OSbackup%\XML2\*.* md %OSbackup%\XML2 | ||
+ | :: -- COPY THE FILES OVER -- | ||
+ | robocopy %OSbinSrc% %OSbackup%\DB *.DB /S /LOG:%OSbackup%\DBlog.txt | ||
+ | robocopy %OSbinSrc%\Exports %OSbackup%\EXPORTS *.* /S /LOG:%OSbackup%\EXPORTSlog.txt | ||
+ | robocopy %OSbinSrc% %OSbackup%\INI *.ini /S /LOG:%OSbackup%\INIlog.txt | ||
+ | robocopy %OSbinSrc% %OSbackup%\LOGS *.log /LOG:%OSbackup%\LOGSlog.txt | ||
+ | robocopy %OSbinSrc%\Regions %OSbackup%\REGIONS *.* /S /LOG:%OSbackup%\REGIONSlog.txt | ||
+ | robocopy %OSbinSrc% %OSbackup%\TXT *.txt /S /LOG:%OSbackup%\INIlog.txt | ||
+ | robocopy %OSbinSrc% %OSbackup%\OAR *.oar /S /LOG:%OSbackup%\OARlog.txt | ||
+ | robocopy %OSbinSrc% %OSbackup%\TERRAINS *.r32 /S /LOG:%OSbackup%\TERRAINSlog.txt | ||
+ | :: | ||
+ | cd %OSbackup%\LOGS | ||
+ | :: uncomment according to Operating System. opensim.log = 32bit OS, opensim.32BitLaunch.log = 64bit operating | ||
+ | RENAME opensim.log OSLOG_(%TimeStamp%).log | ||
+ | ::RENAME OpenSim.32BitLaunch.log OSLOG_(%TimeStamp%).log | ||
+ | :: | ||
+ | :END</source> | ||
---- | ---- | ||
Revision as of 20:46, 24 November 2010
BACKING UP IN WINDOWS
This Posting now includes the more complete Automation System for OpenSim .
SYSTEMS TESTED ON Windows Vista, Windows-7 RC1, Server 2008 r1 (64bit)
MySql 5.1
This works will all system up to OpenSim f84da8e - r11604 (November 27,2009)
Prior to ANY UPGRADE / UPDATE you need to backup your system !
So here I present a BACKUP SCRIPT & RESTORE SCRIPT for the Console, along Batch File at the end to complete the process. This should be used in conjunstion with the Smart Prestart WIN
This is Comprehensive, as it is better to have all types of backups in case OAR or others fail! (It Happens!)
You can copy these command scripts provided into your \BIN Folder.
Highly Recomended:
This System is designed to operated with the following SubStructures to isolate your Backups for Easy Retrieval and archiving.
SINGLE INSTANCE OF OPENSIM
c:\OpenSim <---- Base installation
c:\OpenSim\bin <---- the bin Folder
c:\OpenSim\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders
c:\OpenSim\BACKups\DB <---- for SqlLite Databases
c:\OpenSim\BACKups\DBsql <---- for MySql Databases
c:\OpenSim\BACKups\EXPORTS <---- ExportDirectories transfered here
c:\OpenSim\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories
c:\OpenSim\BACKups\LOGS <---- Log Files Archived Here for Review
c:\OpenSim\BACKups\OAR <---- for OAR Files
c:\OpenSim\BACKups\REGIONS <---- Region.XML or INI files copied here
c:\OpenSim\BACKups\TERRAINS <---- for r32 Terrain Files
c:\OpenSim\BACKups\TXT <---- TXT files used for console scripts copied here
c:\OpenSim\BACKups\XML2 <---- for XML2 Files
Note that EXPORTS are saved in \bin\exports by default, as defined in the OpenSim.ini
IF YOU HAVE MULTIPLE INSTANCES, CHANGE PATHING ACCORDINGLY
C:\OpenSim\INSTANCEa <---- Base installation
C:\OpenSim\INSTANCEa\bin <---- the bin Folder
C:\OpenSim\INSTANCEa\BACKups <---- The Backup SubFolder Structure "base/root" (could be anywhere) !! Best to keep it OUT of \bin and it's subfolders
C:\OpenSim\INSTANCEa\BACKups\DB <---- for SqlLite Databases
C:\OpenSim\INSTANCEa\BACKups\DBsql <---- for MySql Databases
C:\OpenSim\INSTANCEa\BACKups\EXPORTS <---- ExportDirectories transfered here
C:\OpenSim\INSTANCEa\BACKups\INI <---- ALL Active INI Files from BIN and SubDirectories
C:\OpenSim\INSTANCEa\BACKups\LOGS <---- Log Files Archived Here for Review
C:\OpenSim\INSTANCEa\BACKups\OAR <---- for OAR Files
C:\OpenSim\INSTANCEa\BACKups\REGIONS <---- Region.XML or INI files copied here
C:\OpenSim\INSTANCEa\BACKups\TERRAINS <---- for r32 Terrain Files
C:\OpenSim\INSTANCEa\BACKups\TXT <---- TXT files used for console scripts copied here
C:\OpenSim\INSTANCEa\BACKups\XML2 <---- for XML2 Files
SPECIAL NOTE!
The PRESTART Batch File in Smart_Prestart_WIN will autobuild these structures & Perform several important functions
To Run this script, type the following in your console IF BACKUP.TXT is saved in your \bin folder.
command-script backup.txt
CONSOLE SCRIPT "BACKUP.TXT"
; Description: of BACKUP.TXT ; Creates a Full System Backup of all critical data ; Uses Command Console Functions not available otherwise ; ; Creates OAR, XML2, R32 (Region Terrain Files), and places them into the predefined folder structure. ; Modify the folder structure according to your installation ; ; NOTE The Export goes to the default as defined in opensim.ini it is NOT SUGGESTED that this be changed ; ; EXAMPLE is provided for a multi-region install. If you only have one region , or more adjust accordingly ; RENAME Region1, Region2 etc ... according to your region names ; ; OAR FILES ! They do take a while depending on the volume of data on the region. The script will proceed ; and the commands will be queued and processed. IF you watch the destination folder, you will see teh OAR files grow ; as they are being written out to the hard drive. Be Patient if you have a large installation. ; This will imapct system response to those In-World on the region being processed! ; change region root backup export save-all ; change region Region1 terrain save c:\OpenSim\BACKups\TERRAINS\Region1.r32 save xml2 c:\OpenSim\BACKups\XML2\Region1.xml save oar c:\OpenSim\BACKups\OAR\Region1.oar ; change region Region2 terrain save c:\OpenSim\BACKups\TERRAINS\Region2.r32 save xml2 c:\OpenSim\BACKups\XML2\Region2.xml save oar c:\OpenSim\BACKups\OAR\Region2.oar ; ; REPEAT AS NECESSARY, edit "Region#" and change it to YOUR REGION NAME
RESTORATION:
To Run this script, type the following in your console IF RESTORE.TXT is saved in your \bin folder.
command-script restore.txt
CONSOLE SCRIPT "RESTORE.TXT"
; FULL RESTORE PROCESS for OPENSIM CONSOLE ; Description: ; Uses Command Console Functions not available otherwise ; ; RESTORES OAR, R32 (Region Terrain Files), and places them into the Original Regions ; from the Backup\Folder structures as previously defined ; CAN be used to restore XML2 but commented out, there as last resort, IF needed ; ; EXAMPLE is provided for a multi-Region install. If you only have one Region , or more adjust accordingly ; RENAME Region1, Region2 etc ... according to your Region names ; ; OAR FILES ! They do take a while depending on the volume of data on the Region. The script will proceed ; and the commands will be queued and processed. ; change region Region1 terrain load c:\OpenSim\BACKups\TERRAINS\Region1.r32 load oar c:\OpenSim\BACKups\OAR\Region1.oar ; load xml2 c:\OpenSim\BACKups\BACKups\XML2\Region1.xml ; change region Region2 terrain load c:\OpenSim\BACKups\TERRAINS\Region2.r32 load oar c:\OpenSim\BACKups\OAR\Region2.oar ; load xml2 c:\OpenSim\BACKups\XML2\Region2.xml ; ; REPEAT AS NECESSARY, edit "Region#" and change it to YOUR REGION NAME ; ; you will see messages on the console as it completes the queued tasks ;
BATCH File Name: FullBackup.bat
Command to execute: Run in command prompt OR Task Scheduler (see references at bottom of page)
Description: Copies opensim SQL database out & Everything else Important
CAVEATS: none known
LOCATION: Place in folder with other Batch CMD files @ C:\OpenSim\InstanceA Where InstanceA is the directory ABOVE C:\OpenSim\InstanceA\bin
DEPENDENCIES: Use the Posted Console command-script following this, They work together!
@echo off :: FILENAME: FullBackup.bat :: AUTHOR: WhiteStar Magic @ OSGrid :: DATE: REVISED Nov-24-2010 :: :: Operational Under Windows Vista SP1 TO Win Server 2008 R1 (64bit) :: Suitable under other Windows Platforms, but not tested :: :: Added MySql Functions :: Added Further Commenting to better explain what is being done :: Added Additional Folder Backups (Exports complete) :: Added INI & TXT File Backups as well, Accounting for Murphys Laws, (you never know) :: Revised MAY.14.2009 :: Correction added for TimeStamp to remove leading space from time IF time is < 12:00 (Operating System Quirk) :: :: Robocopy.exe can be downloaded from Microsoft Corp/MSDN Website. Search for it and get the latest version. :: XP & Vista Users ! It works fine as long as you have the latest. :: ROBOCOPY COMMANDS AS USED :: SourceFolder TargetFolder FileName /S = DoSubFolders (non-empty) /LOG = Generate LOG of execution :: :: Place this batch file into Microsoft Scheduler, set to daily :: Other scheduler systems can also be used if desired :: ===================================================================================== :: :: CONFIGURING ENVIRONMENT PATHS AND SETUP TO SIMPLIFY CONFIG & ADMIN :: Adjust the following to YOUR INSTALLED Folder Paths :: :: OSbackup = Where you want your Backup File Structure to be and send files to :: OSbinSrc = Where the OpenSim Software is installed and run from :: SET OSbackup=C:\OPENSIM\InstanceA\BACKups SET OSbinSrc=C:\OPENSIM\InstanceA\bin :: :: MYSQL INFORMATION TO BE FILLED OUT. IF DBUSER = XXX MySql Dump will not occur set DBUSER=root set DBPW=YOURPASSWORD set DBNAME=opensim :: :: -------------------------------------------------------------------------------------- :: DATE & TIME String Assembly :: -------------------------------------------------------------------------------------- :: Date & Time Format on your system :: Check your format in command.prompt with DATE/T :: :: EU DATE FORMAT = 15-05-2006 DD-MM-YYYY :: US DATE FORMAT = 05/17/2006 MM/DD/YYYY :: TIME FORMAT 13:45:55 is truncated to 13-45 and colons are removed :: DATES are cleaned of / or - or : depending on your system install & config. :: :: Parse Hour & Minutes Removing incorrect characters or leading spaces :: i=HR, j=min, k=sec,l=msec for /F "usebackq tokens=1,2,3,4 delims=/-:. " %%i in ('%TIME%') do set Ttime=%%i-%%j :: :: Parse the Date String removing unwated characters / or - or 'space' depends on system installation for /F "usebackq tokens=1,2,3,4 delims=/-: " %%i in ('%DATE%') do set Tdate=%%i-%%j-%%k :: set TimeStamp=%Tdate%@%Ttime% :: we now have a string which will appear as 24-11-2010@23-27 :: :: -------------------------------------------------------------------------------------- :: Backup the MySQL DB from Live System :: OpenSim Database Backup Section :: -------------------------------------------------------------------------------------- :: for more information on commands used: :: Open a command shell (DOS Prompt / Console Session) :: Go to the MySql Installation Folder :: NOTE that the output can be reditected into a TXT file so that you can read it in a Text Editor :: Type the Following commands for information at the command prompt :: mysqldump -? :: mysqlshow -? :: to redirect out to TXT file do as shown: :: mysqldump -? > %OSbackup%\MySqlDump_Commands.txt :: mysqlshow -? > %OSbackup%\MySqlShow_Commands.txt :: !!! Target Folder must exist. Adjust Paths according to YOUR installation !!! :: ------------------------------------------------------------------------------------------------- :: make folder if not exist if not exist %OSbackup%\DBsql\*.* md %OSbackup%\DBsql :: :: generate MySql DB Backup if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\%DBNAME%_%TIMESTAMP%.sql :: :: Dump the opensim table struct info for a snapshot of the stats if DBUSER NEQ XXX mysqlshow -v -v -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\OS_db_STATS.txt :: :: ========================= :: END OF MySql DB Backup Section :: ========================= :: :: OPENSIM SYSTEM DATA BACKUP SECTION :: ------------------------------------------------------------------------------------ cd %OSbackup% :: :: if the folders do not exist, create them :: if not exist %OSbackup%\DB\*.* md %OSbackup%\DB if not exist %OSbackup%\INI\*.* md %OSbackup%\INI if not exist %OSbackup%\EXPORTS\*.* md %OSbackup%\EXPORTS if not exist %OSbackup%\LOGS\*.* md %OSbackup%\LOGS if not exist %OSbackup%\OAR\*.* md %OSbackup%\OAR if not exist %OSbackup%\REGIONS\*.* md %OSbackup%\REGIONS if not exist %OSbackup%\TERRAINS\*.* md %OSbackup%\TERRAINS if not exist %OSbackup%\TXT\*.* md %OSbackup%\TXT if not exist %OSbackup%\XML2\*.* md %OSbackup%\XML2 :: -- COPY THE FILES OVER -- robocopy %OSbinSrc% %OSbackup%\DB *.DB /S /LOG:%OSbackup%\DBlog.txt robocopy %OSbinSrc%\Exports %OSbackup%\EXPORTS *.* /S /LOG:%OSbackup%\EXPORTSlog.txt robocopy %OSbinSrc% %OSbackup%\INI *.ini /S /LOG:%OSbackup%\INIlog.txt robocopy %OSbinSrc% %OSbackup%\LOGS *.log /LOG:%OSbackup%\LOGSlog.txt robocopy %OSbinSrc%\Regions %OSbackup%\REGIONS *.* /S /LOG:%OSbackup%\REGIONSlog.txt robocopy %OSbinSrc% %OSbackup%\TXT *.txt /S /LOG:%OSbackup%\INIlog.txt robocopy %OSbinSrc% %OSbackup%\OAR *.oar /S /LOG:%OSbackup%\OARlog.txt robocopy %OSbinSrc% %OSbackup%\TERRAINS *.r32 /S /LOG:%OSbackup%\TERRAINSlog.txt :: cd %OSbackup%\LOGS :: uncomment according to Operating System. opensim.log = 32bit OS, opensim.32BitLaunch.log = 64bit operating RENAME opensim.log OSLOG_(%TimeStamp%).log ::RENAME OpenSim.32BitLaunch.log OSLOG_(%TimeStamp%).log :: :END
BACK-LINKS
Windows
Smart Prestart WIN Backing_Up_WIN Automated Upgrade WIN
Linux
Smart Prestart LINUX Backing Up LINUX Automated Upgrade LINUX
References
Microsoft Task Scheduler http://msdn.microsoft.com/en-us/library/aa383614(VS.85).aspx
WIKI on Task Scedule http://en.wikipedia.org/wiki/Task_Scheduler