Backing Up WIN
From OpenSimulator
(New page: = '''BACKING UP IN WINDOWS''' = '''This Posting now includes the more complete Automation System for OpenSim '''. '''SYSTEMS TESTED ON Windows Vista, Windows-7 RC1, Serv...) |
|||
Line 42: | Line 42: | ||
'''BATCH File Name: FullBackup.bat<br>Command to execute:''' Run in command prompt OR Task Scheduler<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<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<br>:: FILENAME: FullBackup.bat<br>:: AUTHOR: WhiteStar Magic @ OSGrid<br>:: DATE: REVISED SEP-15-2009<br>::<br>:: Operational Under Windows Vista SP1 TO Win Server 2008 R1 (64bit)<br>:: Suitable under other Windows Platforms, but not tested<br>::<br>:: Added MySql Functions <br>:: Added Further Commenting to better explain what is being done<br>:: Added Additional Folder Backups (Exports complete)<br>:: Added INI & TXT File Backups as well, Accounting for Murphys Laws, (you never know)<br>:: Revised MAY.14.2009<br>:: Correction added for TimeStamp to remove leading space from time IF time is < 12:00 (Operating System Quirk)<br>:: <br>:: Robocopy.exe can be downloaded from Microsoft Corp/MSDN Website. Search for it and get the latest version.<br>:: XP & Vista Users ! It works fine as long as you have the latest.<br>:: ROBOCOPY COMMANDS AS USED<br>:: SourceFolder TargetFolder FileName /S = DoSubFolders (non-empty) /LOG = Generate LOG of execution<br>:: <br>:: Place this batch file into Microsoft Scheduler, set to daily<br>:: Other scheduler systems can also be used if desired<br>:: =====================================================================================<br>::<br>:: CONFIGURING ENVIRONMENT PATHS AND SETUP TO SIMPLIFY CONFIG & ADMIN<br>:: Adjust the following to YOUR INSTALLED Folder Paths<br>:: <br>:: OSbackup = Where you want your Backup File Structure to be and send files to<br>:: OSbinSrc = Where the OpenSim Software is installed and run from<br>:: <br>SET OSbackup=C:\OPENSIM\InstanceA\BACKups<br>SET OSbinSrc=C:\OPENSIM\InstanceA\bin<br>::<br>:: MYSQL INFORMATION TO BE FILLED OUT. IF DBUSER = XXX MySql Dump will not occur<br>set DBUSER=root<br>set DBPW=YOURPASSWORD<br>set DBNAME=opensim<br>::<br>:: --------------------------------------------------------------------------------------<br>:: DATE & TIME String Assembly<br>:: --------------------------------------------------------------------------------------<br>:: Date & Time Format on your system<br>:: Check your format in command.prompt with DATE/T<br>::<br>:: EU DATE FORMAT = 15-05-2006 DD-MM-YYYY<br>:: US DATE FORMAT = 05/17/2006 MM/DD/YYYY<br>:: TIME FORMAT 13:45:55 is truncated to 1345 and colons are removed <br>:: DATES are cleaned of / or - or : depending on your system install & config.<br>::<br>:: Parse Hour & Minutes removing : or leading spaces<br>for /F "usebackq tokens=1 delims=:" %%i in ('%TIME%') do set HRa=%%i<br>:: fix the HR in case it has a blank in it<br>for /F "usebackq tokens=1 delims= " %%i in ('%HRa%') do set HR=%%i<br>for /F "usebackq tokens=2 delims=:" %%i in ('%TIME%') do set MIN=%%i<br>::<br>:: Parse the Date String removing unwated charachters / or - depends on system installation<br>for /F "usebackq tokens=1,2,3 delims=/-" %%i in ('%DATE%@') do set Tdate=%%i%%j%%k<br>::<br>set TimeStamp=%Tdate%%HR%%MIN%<br>:: we now have a string which will appear as 12052009@0112<br>::<br>:: --------------------------------------------------------------------------------------<br>:: Backup the MySQL DB from Live System<br>:: OpenSim Database Backup Section<br>:: --------------------------------------------------------------------------------------<br>:: for more information on commands used: <br>:: Open a command shell (DOS Prompt / Console Session)<br>:: Go to the MySql Installation Folder<br>:: NOTE that the output can be reditected into a TXT file so that you can read it in a Text Editor<br>:: Type the Following commands for information at the command prompt<br>:: mysqldump -?<br>:: mysqlshow -?<br>:: to redirect out to TXT file do as shown:<br>:: mysqldump -? > %OSbackup%\MySqlDump_Commands.txt<br>:: mysqlshow -? > %OSbackup%\MySqlShow_Commands.txt<br>:: !!! Target Folder must exist. Adjust Paths according to YOUR installation !!!<br>:: -------------------------------------------------------------------------------------------------<br>:: make folder if not exist<br>if not exist %OSbackup%\DBsql\*.* md %OSbackup%\DBsql<br>::<br>:: generate MySql DB Backup<br>if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OS_Instance%\BACKup\DBsql\%DBNAME%_%TIMESTAMP%.sql<br>:: <br>:: Dump the opensim table struct info for a snapshot of the stats <br>if DBUSER NEQ XXX mysqlshow -v -v -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\OS_db_STATS.txt<br>::<br>:: =========================<br>:: END OF MySql DB Backup Section<br>:: =========================<br>:: <br>:: OPENSIM SYSTEM DATA BACKUP SECTION<br>:: ------------------------------------------------------------------------------------<br>cd %OSbackup%<br>:: <br>:: if the folders do not exist, create them<br>:: <br>if not exist %OSbackup%\DB\*.* md %OSbackup%\DB<br>if not exist %OSbackup%\INI\*.* md %OSbackup%\INI<br>if not exist %OSbackup%\EXPORTS\*.* md %OSbackup%\EXPORTS<br>if not exist %OSbackup%\LOGS\*.* md %OSbackup%\LOGS<br>if not exist %OSbackup%\OAR\*.* md %OSbackup%\OAR<br>if not exist %OSbackup%\REGIONS\*.* md %OSbackup%\REGIONS<br>if not exist %OSbackup%\TERRAINS\*.* md %OSbackup%\TERRAINS<br>if not exist %OSbackup%\TXT\*.* md %OSbackup%\TXT<br>if not exist %OSbackup%\XML2\*.* md %OSbackup%\XML2<br>:: -- COPY THE FILES OVER -- <br>robocopy %OSbinSrc% %OSbackup%\DB *.DB /S /LOG:%OSbackup%\DBlog.txt<br>robocopy %OSbinSrc%\Exports %OSbackup%\EXPORTS *.* /S /LOG:%OSbackup%\EXPORTSlog.txt<br>robocopy %OSbinSrc% %OSbackup%\INI *.ini /S /LOG:%OSbackup%\INIlog.txt<br>robocopy %OSbinSrc% %OSbackup%\LOGS *.log /LOG:%OSbackup%\LOGSlog.txt<br>robocopy %OSbinSrc%\Regions %OSbackup%\REGIONS *.* /S /LOG:%OSbackup%\REGIONSlog.txt<br>robocopy %OSbinSrc% %OSbackup%\TXT *.txt /S /LOG:%OSbackup%\INIlog.txt<br>robocopy %OSbinSrc% %OSbackup%\OAR *.tar.gz /S /LOG:%OSbackup%\OARlog.txt<br>robocopy %OSbinSrc% %OSbackup%\TERRAINS *.r32 /S /LOG:%OSbackup%\TERRAINSlog.txt<br>:: <br>cd %OSbackup%\LOGS<br>RENAME opensim.log OSLOG_(%TimeStamp%).log<br>:: <br>:END </blockquote> | <blockquote><br>@echo off<br>:: FILENAME: FullBackup.bat<br>:: AUTHOR: WhiteStar Magic @ OSGrid<br>:: DATE: REVISED SEP-15-2009<br>::<br>:: Operational Under Windows Vista SP1 TO Win Server 2008 R1 (64bit)<br>:: Suitable under other Windows Platforms, but not tested<br>::<br>:: Added MySql Functions <br>:: Added Further Commenting to better explain what is being done<br>:: Added Additional Folder Backups (Exports complete)<br>:: Added INI & TXT File Backups as well, Accounting for Murphys Laws, (you never know)<br>:: Revised MAY.14.2009<br>:: Correction added for TimeStamp to remove leading space from time IF time is < 12:00 (Operating System Quirk)<br>:: <br>:: Robocopy.exe can be downloaded from Microsoft Corp/MSDN Website. Search for it and get the latest version.<br>:: XP & Vista Users ! It works fine as long as you have the latest.<br>:: ROBOCOPY COMMANDS AS USED<br>:: SourceFolder TargetFolder FileName /S = DoSubFolders (non-empty) /LOG = Generate LOG of execution<br>:: <br>:: Place this batch file into Microsoft Scheduler, set to daily<br>:: Other scheduler systems can also be used if desired<br>:: =====================================================================================<br>::<br>:: CONFIGURING ENVIRONMENT PATHS AND SETUP TO SIMPLIFY CONFIG & ADMIN<br>:: Adjust the following to YOUR INSTALLED Folder Paths<br>:: <br>:: OSbackup = Where you want your Backup File Structure to be and send files to<br>:: OSbinSrc = Where the OpenSim Software is installed and run from<br>:: <br>SET OSbackup=C:\OPENSIM\InstanceA\BACKups<br>SET OSbinSrc=C:\OPENSIM\InstanceA\bin<br>::<br>:: MYSQL INFORMATION TO BE FILLED OUT. IF DBUSER = XXX MySql Dump will not occur<br>set DBUSER=root<br>set DBPW=YOURPASSWORD<br>set DBNAME=opensim<br>::<br>:: --------------------------------------------------------------------------------------<br>:: DATE & TIME String Assembly<br>:: --------------------------------------------------------------------------------------<br>:: Date & Time Format on your system<br>:: Check your format in command.prompt with DATE/T<br>::<br>:: EU DATE FORMAT = 15-05-2006 DD-MM-YYYY<br>:: US DATE FORMAT = 05/17/2006 MM/DD/YYYY<br>:: TIME FORMAT 13:45:55 is truncated to 1345 and colons are removed <br>:: DATES are cleaned of / or - or : depending on your system install & config.<br>::<br>:: Parse Hour & Minutes removing : or leading spaces<br>for /F "usebackq tokens=1 delims=:" %%i in ('%TIME%') do set HRa=%%i<br>:: fix the HR in case it has a blank in it<br>for /F "usebackq tokens=1 delims= " %%i in ('%HRa%') do set HR=%%i<br>for /F "usebackq tokens=2 delims=:" %%i in ('%TIME%') do set MIN=%%i<br>::<br>:: Parse the Date String removing unwated charachters / or - depends on system installation<br>for /F "usebackq tokens=1,2,3 delims=/-" %%i in ('%DATE%@') do set Tdate=%%i%%j%%k<br>::<br>set TimeStamp=%Tdate%%HR%%MIN%<br>:: we now have a string which will appear as 12052009@0112<br>::<br>:: --------------------------------------------------------------------------------------<br>:: Backup the MySQL DB from Live System<br>:: OpenSim Database Backup Section<br>:: --------------------------------------------------------------------------------------<br>:: for more information on commands used: <br>:: Open a command shell (DOS Prompt / Console Session)<br>:: Go to the MySql Installation Folder<br>:: NOTE that the output can be reditected into a TXT file so that you can read it in a Text Editor<br>:: Type the Following commands for information at the command prompt<br>:: mysqldump -?<br>:: mysqlshow -?<br>:: to redirect out to TXT file do as shown:<br>:: mysqldump -? > %OSbackup%\MySqlDump_Commands.txt<br>:: mysqlshow -? > %OSbackup%\MySqlShow_Commands.txt<br>:: !!! Target Folder must exist. Adjust Paths according to YOUR installation !!!<br>:: -------------------------------------------------------------------------------------------------<br>:: make folder if not exist<br>if not exist %OSbackup%\DBsql\*.* md %OSbackup%\DBsql<br>::<br>:: generate MySql DB Backup<br>if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OS_Instance%\BACKup\DBsql\%DBNAME%_%TIMESTAMP%.sql<br>:: <br>:: Dump the opensim table struct info for a snapshot of the stats <br>if DBUSER NEQ XXX mysqlshow -v -v -u%DBUSER% -p%DBPW% %DBNAME% > %OSbackup%\DBsql\OS_db_STATS.txt<br>::<br>:: =========================<br>:: END OF MySql DB Backup Section<br>:: =========================<br>:: <br>:: OPENSIM SYSTEM DATA BACKUP SECTION<br>:: ------------------------------------------------------------------------------------<br>cd %OSbackup%<br>:: <br>:: if the folders do not exist, create them<br>:: <br>if not exist %OSbackup%\DB\*.* md %OSbackup%\DB<br>if not exist %OSbackup%\INI\*.* md %OSbackup%\INI<br>if not exist %OSbackup%\EXPORTS\*.* md %OSbackup%\EXPORTS<br>if not exist %OSbackup%\LOGS\*.* md %OSbackup%\LOGS<br>if not exist %OSbackup%\OAR\*.* md %OSbackup%\OAR<br>if not exist %OSbackup%\REGIONS\*.* md %OSbackup%\REGIONS<br>if not exist %OSbackup%\TERRAINS\*.* md %OSbackup%\TERRAINS<br>if not exist %OSbackup%\TXT\*.* md %OSbackup%\TXT<br>if not exist %OSbackup%\XML2\*.* md %OSbackup%\XML2<br>:: -- COPY THE FILES OVER -- <br>robocopy %OSbinSrc% %OSbackup%\DB *.DB /S /LOG:%OSbackup%\DBlog.txt<br>robocopy %OSbinSrc%\Exports %OSbackup%\EXPORTS *.* /S /LOG:%OSbackup%\EXPORTSlog.txt<br>robocopy %OSbinSrc% %OSbackup%\INI *.ini /S /LOG:%OSbackup%\INIlog.txt<br>robocopy %OSbinSrc% %OSbackup%\LOGS *.log /LOG:%OSbackup%\LOGSlog.txt<br>robocopy %OSbinSrc%\Regions %OSbackup%\REGIONS *.* /S /LOG:%OSbackup%\REGIONSlog.txt<br>robocopy %OSbinSrc% %OSbackup%\TXT *.txt /S /LOG:%OSbackup%\INIlog.txt<br>robocopy %OSbinSrc% %OSbackup%\OAR *.tar.gz /S /LOG:%OSbackup%\OARlog.txt<br>robocopy %OSbinSrc% %OSbackup%\TERRAINS *.r32 /S /LOG:%OSbackup%\TERRAINSlog.txt<br>:: <br>cd %OSbackup%\LOGS<br>RENAME opensim.log OSLOG_(%TimeStamp%).log<br>:: <br>:END </blockquote> | ||
+ | |||
+ | ---- | ||
+ | '''BACK-LINKS''' | ||
+ | |||
+ | == Windows == | ||
+ | [[Smart Prestart WIN]] [[Backing Up WIN]] [[Automated Upgrade WIN]] | ||
+ | |||
+ | == Linux == | ||
+ | [[Smart Prestart LINUX]] [[Backing Up LINUX]] [[Automated Upgrade LINUX]] |
Revision as of 19:03, 15 September 2009
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 9700 to Current GIT# c5455d4 - r10713
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.tar.gz
;
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.tar.gz
;
; 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.tar.gz
; 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.tar.gz
; load xml2 c:\OpenSim\BACKups\XML2\Region2.xml
;
; you will see messages on the console as it completes queued tasks
BATCH File Name: FullBackup.bat
Command to execute: Run in command prompt OR Task Scheduler
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 SEP-15-2009
::
:: 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 1345 and colons are removed
:: DATES are cleaned of / or - or : depending on your system install & config.
::
:: Parse Hour & Minutes removing : or leading spaces
for /F "usebackq tokens=1 delims=:" %%i in ('%TIME%') do set HRa=%%i
:: fix the HR in case it has a blank in it
for /F "usebackq tokens=1 delims= " %%i in ('%HRa%') do set HR=%%i
for /F "usebackq tokens=2 delims=:" %%i in ('%TIME%') do set MIN=%%i
::
:: Parse the Date String removing unwated charachters / or - depends on system installation
for /F "usebackq tokens=1,2,3 delims=/-" %%i in ('%DATE%@') do set Tdate=%%i%%j%%k
::
set TimeStamp=%Tdate%%HR%%MIN%
:: we now have a string which will appear as 12052009@0112
::
:: --------------------------------------------------------------------------------------
:: 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% > %OS_Instance%\BACKup\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 *.tar.gz /S /LOG:%OSbackup%\OARlog.txt
robocopy %OSbinSrc% %OSbackup%\TERRAINS *.r32 /S /LOG:%OSbackup%\TERRAINSlog.txt
::
cd %OSbackup%\LOGS
RENAME opensim.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