Automated Upgrade WIN
From OpenSimulator
(change download adress of osgrid files) |
(housekeeping & minor update) |
||
Line 24: | Line 24: | ||
- '''OPTIONAL''' you can use a LOCAL REPOSITORY for your own BINARY which must be packaged into a ZIP file. (see === PROCESS UPDATE === Section in the Batch File) | - '''OPTIONAL''' you can use a LOCAL REPOSITORY for your own BINARY which must be packaged into a ZIP file. (see === PROCESS UPDATE === Section in the Batch File) | ||
− | <blockquote>@echo OFF | + | <blockquote></blockquote><source lang="text">@echo OFF |
+ | :: | ||
+ | :: FILENAME: Upgrade_OS.bat | ||
+ | :: AUTHOR: WhiteStar Magic @ OSGrid | ||
+ | :: DATE: October 24,2010 | ||
+ | :: REVISION: 0.4 (changing paths due to changes in OpenSim 07x & OSG Deployment of same) | ||
+ | :: | ||
+ | :: DESCRIPTION: | ||
+ | :: | ||
+ | :: Upgrades OpenSim Instances from SOURCE Website. | ||
+ | :: Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review | ||
+ | :: and mods prior to startup. (INI's change so should be reviewed prior to initializing) | ||
+ | :: COMMANDLINE REFERENCE (BATCHFILES) http://technet.microsoft.com/en-ca/library/bb490890.aspx | ||
+ | :: | ||
+ | :: INSTALLATION: | ||
+ | :: save this script into a convenient folder | ||
+ | :: if you have OpenSim Instances, for example C:\OpenSim\instanceA & C:\OpenSim\instanceB | ||
+ | :: I suggest installing it in c:\OS_upgrader | ||
+ | :: | ||
+ | :: DEPENDENCIES: | ||
+ | :: Robocopy Enhanced Copy tool from Microsoft | ||
+ | :: | ||
+ | :: Wget for Windows | ||
+ | :: DOWNLOAD wget for Windows utility and unzip to C:\OS_upgrader | ||
+ | :: (OLDER but tested & works up to Windows_2008_server-R1 64bit) | ||
+ | :: available @ http://pages.interlog.com/~tcharron/wgetwin.html | ||
+ | :: http://www.interlog.com/~tcharron/wgetwin-1_5_3_1-binary.zip | ||
+ | :: | ||
+ | :: 7-zip Free Windows zip archiver | ||
+ | :: DOWNLOAD - the gui version for your daily use | ||
+ | :: - the commandline version, (used by this system) | ||
+ | :: available @ http://www.7-zip.org/ | ||
+ | :: http://www.7-zip.org/download.html | ||
+ | :: install commandline 7-zip into C:\OS_upgrader | ||
+ | :: | ||
+ | :: | ||
+ | :: RUNNING: | ||
+ | :: | ||
+ | :: Run with the following command Upgrade_OS.bat | ||
+ | :: ( easier to make a shortcut on your desktop to it ) | ||
+ | :: can be installed in another directory, Adjust the script accordingly | ||
+ | :: | ||
+ | :: ========================================== | ||
+ | :: === GENERAL VARIABLES THAT MUST BE SET === | ||
+ | :: ========================================== | ||
+ | :: | ||
+ | :: check http://download.osgrid.org/?dir=&sort_by=mod&sort_as=asc | ||
+ | :: for latest ZIP Binary from OSGrid | ||
+ | :: | ||
+ | :: shows ONLY LATEST Zip File available | ||
+ | :: http://download.osgrid.org/autowin | ||
+ | :: | ||
+ | :: | ||
+ | :: where to store your upgrade repository | ||
+ | set OS_UPD_REPO=C:\OPENSIM\Upgrader | ||
+ | :: | ||
+ | :: SOURCE PATH to get the WEB Binary ZIP OR Local Files | ||
+ | :: This path can be directed to another server or LOCALIZED Binary Repository | ||
+ | :: IF LOCAL place the path to the bin folder below IE: C:\MY_COMPILED\bin | ||
+ | :: | ||
+ | set OS_SRC=http://download.osgrid.org/autowin | ||
+ | :: set OS_SRC=C:\MY_COMPILED\bin | ||
+ | :: | ||
+ | :: For OSGrid Latest Posted Binaries, Use this line below | ||
+ | :: set OS_SRC=http://download.osgrid.org | ||
+ | :: | ||
+ | :: ================================== | ||
+ | :: === PERFORM THE UPGRADE\UPDATE === | ||
+ | :: ================================== | ||
+ | :: IF WEB REPO (from website) COMMENT OUT "REM call :GET_update_LCL" statement | ||
+ | :: IF LOCAL REPO (non web) COMMENT OUT "REM call :GET_update_WEB" statement | ||
+ | :: | ||
+ | call :GET_update_WEB | ||
+ | :: call :GET_update_LCL | ||
+ | :: | ||
+ | :: ========================= | ||
+ | :: --- Upgrade Instances --- | ||
+ | :: ========================= | ||
+ | :: | ||
+ | :: you must set the OS_Instance next for EACH INSTANCE | ||
+ | :: carefully look at the syntax | ||
+ | :: it is the path to the root of the instance to be updated | ||
+ | :: | ||
+ | :: This will backup MySql Databases PRIOR to Upgrade | ||
+ | :: IF the DBUSER = XXX it will not do so | ||
+ | :: INSTANCEa shows an EXAMPLE for backing up the MySql opensim DB | ||
+ | :: ? Why this way ? Several People run different DB's for each instance | ||
+ | ::SYNTAX: | ||
+ | :: OS_INSTANCE OS_InstanceName DBUSER DBPW DBNAME | ||
+ | :: | ||
+ | ::call :DO_update C:\opensim\INSTANCEa INSTANCEa root PASSWORD opensim | ||
+ | ::call :DO_update C:\opensim\INSTANCEb INSTANCEb XXX | ||
+ | ::call :DO_update C:\opensim\INSTANCEc INSTANCEc XXX | ||
+ | ::call :DO_update C:\opensim\INSTANCEd INSTANCEe XXX | ||
+ | ::call :DO_update C:\opensim\INSTANCEe INSTANCEf XXX | ||
+ | ::call :DO_update C:\opensim\INSTANCEg INSTANCEh XXX | ||
+ | ::call :DO_update C:\opensim\INSTANCEh INSTANCEi XXX | ||
+ | :: | ||
+ | call :DO_update C:\OPENSIM\SA SA DBUSER DBpassword opensim_sa | ||
+ | call :DO_update C:\OPENSIM\OSG OSG DBUSER DBpassword opensim_osg | ||
+ | :: | ||
+ | :: | ||
+ | goto:END | ||
+ | :: | ||
+ | :: ====================== | ||
+ | :: === GET UPDATE LCL === | ||
+ | :: ====================== | ||
+ | :GET_update_LCL | ||
+ | :: COPIES files from your LOCAL REPO C:\MY_COMPILES\BIN for distribution | ||
+ | :: | ||
+ | if not exist %OS_UPD_REPO%\*.* md %OS_UPD_REPO% | ||
+ | :: | ||
+ | robocopy %OS_SRC% %OS_UPD_REPO%\bin *.* /MIR | ||
+ | :: | ||
+ | goto:eof | ||
+ | :: | ||
+ | :: ====================== | ||
+ | :: === GET UPDATE WEB === | ||
+ | :: ====================== | ||
+ | :GET_update_WEB | ||
+ | :: change to the UPDATE REPOSITORY, get the source ZIP file from the web | ||
+ | if not exist %OS_UPD_REPO%\*.* md %OS_UPD_REPO% | ||
+ | :: | ||
+ | ::get the latest current rev ZIP line from Website and write to file cur_rev | ||
+ | wget -O%OS_UPD_REPO%\cur_revision.txt %OS_SRC% | ||
+ | :: | ||
+ | ::get the new / latest zip file as received above | ||
+ | wget -nc -i%OS_UPD_REPO%\cur_revision.txt -P%OS_UPD_REPO% | ||
+ | :: | ||
+ | :: unpack & prep | ||
+ | if exist %OS_UPD_REPO%\bin\*.* rmdir /S /Q %OS_UPD_REPO%\bin | ||
+ | :: | ||
+ | 7za x %OS_UPD_REPO%\*.zip -o%OS_UPD_REPO% -aoa | ||
+ | :: | ||
+ | if not exist %OS_UPD_REPO%\src_archive\*.* mkdir %OS_UPD_REPO%\src_archive | ||
+ | move /Y %OS_UPD_REPO%\*.zip %OS_UPD_REPO%\src_archive | ||
+ | :: | ||
+ | ECHO "GET_UPDATE_WEB COMPLETED" | ||
+ | goto:eof | ||
+ | :: | ||
+ | :: ======================== | ||
+ | :: === PROCESS Upgrades === | ||
+ | :: ======================== | ||
+ | :DO_update | ||
+ | :: | ||
+ | set OS_Instance=%1 | ||
+ | set DBUSER=%3 | ||
+ | set DBPW=%4 | ||
+ | set DBNAME=%5 | ||
+ | :: | ||
+ | :: change dir to OpenSim Instance & delete previous if exist & CREATE bin_NEW for latest version | ||
+ | cd %OS_Instance% | ||
+ | :: | ||
+ | :: generate DB Backup after making sure the directory exists | ||
+ | if not exist %OS_Instance%\BACKups\*.* md %OS_Instance% | ||
+ | if not exist %OS_Instance%\BACKups\DBsql\*.* md %OS_Instance%\BACKups\DBsql | ||
+ | if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OS_Instance%\BACKups\DBsql\%DBNAME%_PRE_upgrade.sql | ||
+ | :: | ||
+ | if exist %OS_Instance%\bin_NEW\*.* rmdir /S /Q %OS_Instance%\bin_NEW | ||
+ | :: | ||
+ | :: transfer new upgrade into the new instance | ||
+ | robocopy %OS_UPD_REPO%\bin %OS_Instance%\bin_NEW *.* /S | ||
+ | :: | ||
+ | :: rename the Upgrade ini files in the config-include directory | ||
+ | copy /Y %OS_Instance%\bin_NEW\config-include\*.ini %OS_Instance%\bin_NEW\config-include\*.ini.UPG | ||
+ | :: copy the original ini files from previous version | ||
+ | copy /Y %OS_Instance%\bin\config-include\*.ini %OS_Instance%\bin_NEW\config-include | ||
+ | :: | ||
+ | :: Transfer the appropriate files over to ready it for operation | ||
+ | :: | ||
+ | copy /Y %OS_Instance%\bin\Regions\*.* %OS_Instance%\bin_NEW\Regions | ||
+ | copy /Y %OS_Instance%\bin\estate_settings.xml %OS_Instance%\bin_NEW\estate_settings.xml | ||
+ | copy /Y %OS_Instance%\bin\*.db %OS_Instance%\bin_NEW | ||
+ | :: | ||
+ | copy /Y %OS_Instance%\bin_NEW\OpenSim.ini %OS_Instance%\bin_NEW\OpenSim.ini.UPG | ||
+ | copy /Y %OS_Instance%\bin\OpenSim.ini %OS_Instance%\bin_NEW\OpenSim.ini | ||
+ | :: | ||
+ | echo "WHEN READY, RENAME \bin to \bin_OLD & RENAME \bin_NEW to \bin" | ||
+ | goto:eof | ||
+ | :: | ||
+ | :: | ||
+ | :END</source> | ||
'''SWITCH OpenSim POST UPGRADE''' | '''SWITCH OpenSim POST UPGRADE''' | ||
Line 34: | Line 215: | ||
Edit the Batch File and change the PATHS & INSTANCE NAMES | Edit the Batch File and change the PATHS & INSTANCE NAMES | ||
− | <blockquote>@echo OFF | + | <blockquote></blockquote><source lang="text">@echo OFF |
+ | :: | ||
+ | :: FILENAME: SWITCH_OS.bat | ||
+ | :: AUTHOR: WhiteStar Magic @ OSGrid | ||
+ | :: DATE: September.16.2009 | ||
+ | :: REVISION: 0.2 | ||
+ | :: | ||
+ | :: DESCRIPTION: | ||
+ | :: | ||
+ | :: Upgrades OpenSim Instances from SOURCE Website. | ||
+ | :: Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review | ||
+ | :: and mods prior to startup. (INI's change so should be reviewed prior to initializing) | ||
+ | :: | ||
+ | :: INSTALLATION: | ||
+ | :: save this script into a convenient folder | ||
+ | :: if you have OpenSim Instances, for example O:\OSgrid\instanceA & O:\OSgrid\instanceB | ||
+ | :: I suggest installing it in c:\OS_upgrader | ||
+ | :: | ||
+ | :: RUNNING: | ||
+ | :: | ||
+ | :: Run with the following command SWITCH_OS.bat | ||
+ | :: ( easier to make a shortcut on your desktop to it ) | ||
+ | :: can be installed in another directory, Adjust the script accordingly | ||
+ | :: | ||
+ | :: ================================== | ||
+ | :: === PERFORM THE UPGRADE\UPDATE === | ||
+ | :: ================================== | ||
+ | :: | ||
+ | :: you must set the OS_Instance next for EACH INSTANCE | ||
+ | :: carefully look at the syntax | ||
+ | :: it is the path to the root of the instance to be updated | ||
+ | :: | ||
+ | call :DO_switch C:\OPENSIM\INSTANCEa | ||
+ | call :DO_switch C:\OPENSIM\INSTANCEb | ||
+ | call :DO_switch C:\OPENSIM\INSTANCEc | ||
+ | call :DO_switch C:\OPENSIM\INSTANCEd | ||
+ | call :DO_switch C:\OPENSIM\INSTANCEe | ||
+ | :: | ||
+ | :: | ||
+ | goto:END | ||
+ | :: | ||
+ | :: ========================= | ||
+ | :: === SWITCH TO Upgrade === | ||
+ | :: ========================= | ||
+ | @echo ON | ||
+ | :DO_switch | ||
+ | :: | ||
+ | set OS_Instance=%1 | ||
+ | :: | ||
+ | :: change dir to OpenSim Instance & RENAME bin to bin_OLD & RENAME bin_NEW to bin | ||
+ | cd %OS_Instance% | ||
+ | :: | ||
+ | if exist %OS_Instance%\bin_OLD rmdir /S /Q %OS_Instance%\bin_OLD | ||
+ | :: | ||
+ | rename bin bin_OLD | ||
+ | :: | ||
+ | rename bin_NEW bin | ||
+ | :: | ||
+ | goto:eof | ||
+ | :: | ||
+ | :: | ||
+ | :END</source> | ||
<br>'''UPGRADE REVERSION''' | <br>'''UPGRADE REVERSION''' | ||
Line 40: | Line 282: | ||
'''SPECIAL NOTE'''<br>- '''This process depends on the fact that you renamed your previous old \bin folder to bin_OLD<br>'''- '''That the INSTANCE(s) IS/ARE SHUTDOWN !!!!!!!!!!!''' | '''SPECIAL NOTE'''<br>- '''This process depends on the fact that you renamed your previous old \bin folder to bin_OLD<br>'''- '''That the INSTANCE(s) IS/ARE SHUTDOWN !!!!!!!!!!!''' | ||
− | <blockquote><br>@echo OFF | + | <blockquote><br></blockquote><source lang="text">@echo OFF |
+ | :: | ||
+ | :: FILENAME: REVERT_OS.bat | ||
+ | :: AUTHOR: WhiteStar Magic @ OSGrid | ||
+ | :: DATE: September.02.2009 | ||
+ | :: REVISION: 0.1 (initial release) | ||
+ | :: | ||
+ | :: DESCRIPTION: | ||
+ | :: | ||
+ | :: REVERTS OpenSim Instances which have been upgraded (just in case). | ||
+ | :: | ||
+ | :: INSTALLATION: | ||
+ | :: Install this in same folder as the Auto Upgrader C:\OS_upgrader | ||
+ | :: | ||
+ | :: RUNNING: | ||
+ | :: | ||
+ | :: Run with the following command REVERT_OS.bat | ||
+ | :: ( easier to make a shortcut on your desktop to it ) | ||
+ | :: can be installed in another directory, Adjust the script accordingly | ||
+ | :: | ||
+ | :: ========================================== | ||
+ | :: === GENERAL VARIABLES THAT MUST BE SET === | ||
+ | :: ========================================== | ||
+ | :: | ||
+ | :: ======================== | ||
+ | :: --- REVERT Instances --- | ||
+ | :: ======================== | ||
+ | :: | ||
+ | :: you must set the OS_Instance next for EACH INSTANCE | ||
+ | :: carefully look at the syntax | ||
+ | :: it is the path to the root of the instance to be updated | ||
+ | :: | ||
+ | call :DO_revert C:\opensim\INSTANCEa | ||
+ | call :DO_revert C:\opensim\INSTANCEb | ||
+ | call :DO_revert C:\opensim\INSTANCEc | ||
+ | call :DO_revert C:\opensim\INSTANCEd | ||
+ | call :DO_revert C:\opensim\INSTANCEe | ||
+ | call :DO_revert C:\opensim\INSTANCEf | ||
+ | call :DO_revert C:\opensim\INSTANCEg | ||
+ | call :DO_revert C:\opensim\INSTANCEh | ||
+ | :: | ||
+ | goto:END | ||
+ | :: | ||
+ | :: ========================= | ||
+ | :: === PROCESS REVERSION === | ||
+ | :: ========================= | ||
+ | :DO_revert | ||
+ | :: | ||
+ | set OS_Instance=%1 | ||
+ | :: | ||
+ | :: change dir to OpenSim Instance | ||
+ | cd %OS_Instance% | ||
+ | :: | ||
+ | :: rename the DIRECTORIES | ||
+ | rename %OS_Instance%\bin %OS_Instance%\bin_REVERTED | ||
+ | rename %OS_Instance%\bin_OLD %OS_Instance%\bin | ||
+ | :: | ||
+ | goto:eof | ||
+ | :: | ||
+ | :: | ||
+ | :END</source> | ||
---- | ---- | ||
Revision as of 20:50, 24 November 2010
AUTOMATED UPGRADE Processor for Windows Platforms
Many of us want to upgrade / update our opensim servers. It's an amazingly tedious task to do so and it's really easy to forget a file here or there and go through it all every time. Well, being an automator I got fed up and write this up and have tested it and works like I charm. I can run this and in under 2 minutes, 9 OpenSim Instances are completed and ready to switch over to a new rev. It prepares everything and is ready for you to review changes in the INI files (which are constant) but all the hard work is done for you.
!! IT DOES NOT START UP NEW INSTANCES !!
I am also using a more robust Pre-Starter for opensim which can be found at Smart Prestart WIN as this works in conjunction with the rest of the tools.
DESCRIPTION:
- Upgrades OpenSim Instances from SOURCE Website.
- Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review
- and mods prior to startup. (INI's change so should be reviewed prior to initializing)
INSTALLATION:
Save this script into a convenient folder, I suggest installing it in C:\OS_upgrader
DEPENDENCIES:
Robocopy Enhanced Copy tool from Microsoft
Wget for Windows
DOWNLOAD wget for Windows utility and unzip to C:\OS_upgrader
(OLDER but tested & works up to Windows_2008_server-R1 64bit)
Available @ http://pages.interlog.com/~tcharron/wgetwin.html
http://www.interlog.com/~tcharron/wgetwin-1_5_3_1-binary.zip
7-zip Free Windows zip archiver
DOWNLOAD - the gui version for your daily use
DOWNLOAD - the commandline version, (used by this system)
available @ http://www.7-zip.org/
http://www.7-zip.org/download.html
install commandline 7-zip into C:\OS_upgrader
COMPLETING UPGRADE
- Once this process is finished, you will have a bin_NEW located in your c:\opensim\instanceA directory. Where instanceA = the ONE directory beneath c:\opensim\instanceA\bin
- Review the original OpenSim.ini with the OpenSim.ini.UPG and adjust according to ANY NEW CHANGES located in the .UPG
- What is the .UPG ? I have the file rename all the new INI files to have an extension of .UPG in order to preserve them for comparison against the existing INI files. ALL INI files from the upgrade get renamed and preserved in this manner.
- Once statisfied that all is in order. Shutdown your instance, rename the ORIGINAL \bin directory to bin_OLD (in case you have to roll back)
- Rename \bin_NEW to \bin and run the startup. (see below for advanced start up process.)
- OPTIONAL you can use a LOCAL REPOSITORY for your own BINARY which must be packaged into a ZIP file. (see === PROCESS UPDATE === Section in the Batch File)
@echo OFF :: :: FILENAME: Upgrade_OS.bat :: AUTHOR: WhiteStar Magic @ OSGrid :: DATE: October 24,2010 :: REVISION: 0.4 (changing paths due to changes in OpenSim 07x & OSG Deployment of same) :: :: DESCRIPTION: :: :: Upgrades OpenSim Instances from SOURCE Website. :: Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review :: and mods prior to startup. (INI's change so should be reviewed prior to initializing) :: COMMANDLINE REFERENCE (BATCHFILES) http://technet.microsoft.com/en-ca/library/bb490890.aspx :: :: INSTALLATION: :: save this script into a convenient folder :: if you have OpenSim Instances, for example C:\OpenSim\instanceA & C:\OpenSim\instanceB :: I suggest installing it in c:\OS_upgrader :: :: DEPENDENCIES: :: Robocopy Enhanced Copy tool from Microsoft :: :: Wget for Windows :: DOWNLOAD wget for Windows utility and unzip to C:\OS_upgrader :: (OLDER but tested & works up to Windows_2008_server-R1 64bit) :: available @ http://pages.interlog.com/~tcharron/wgetwin.html :: http://www.interlog.com/~tcharron/wgetwin-1_5_3_1-binary.zip :: :: 7-zip Free Windows zip archiver :: DOWNLOAD - the gui version for your daily use :: - the commandline version, (used by this system) :: available @ http://www.7-zip.org/ :: http://www.7-zip.org/download.html :: install commandline 7-zip into C:\OS_upgrader :: :: :: RUNNING: :: :: Run with the following command Upgrade_OS.bat :: ( easier to make a shortcut on your desktop to it ) :: can be installed in another directory, Adjust the script accordingly :: :: ========================================== :: === GENERAL VARIABLES THAT MUST BE SET === :: ========================================== :: :: check http://download.osgrid.org/?dir=&sort_by=mod&sort_as=asc :: for latest ZIP Binary from OSGrid :: :: shows ONLY LATEST Zip File available :: http://download.osgrid.org/autowin :: :: :: where to store your upgrade repository set OS_UPD_REPO=C:\OPENSIM\Upgrader :: :: SOURCE PATH to get the WEB Binary ZIP OR Local Files :: This path can be directed to another server or LOCALIZED Binary Repository :: IF LOCAL place the path to the bin folder below IE: C:\MY_COMPILED\bin :: set OS_SRC=http://download.osgrid.org/autowin :: set OS_SRC=C:\MY_COMPILED\bin :: :: For OSGrid Latest Posted Binaries, Use this line below :: set OS_SRC=http://download.osgrid.org :: :: ================================== :: === PERFORM THE UPGRADE\UPDATE === :: ================================== :: IF WEB REPO (from website) COMMENT OUT "REM call :GET_update_LCL" statement :: IF LOCAL REPO (non web) COMMENT OUT "REM call :GET_update_WEB" statement :: call :GET_update_WEB :: call :GET_update_LCL :: :: ========================= :: --- Upgrade Instances --- :: ========================= :: :: you must set the OS_Instance next for EACH INSTANCE :: carefully look at the syntax :: it is the path to the root of the instance to be updated :: :: This will backup MySql Databases PRIOR to Upgrade :: IF the DBUSER = XXX it will not do so :: INSTANCEa shows an EXAMPLE for backing up the MySql opensim DB :: ? Why this way ? Several People run different DB's for each instance ::SYNTAX: :: OS_INSTANCE OS_InstanceName DBUSER DBPW DBNAME :: ::call :DO_update C:\opensim\INSTANCEa INSTANCEa root PASSWORD opensim ::call :DO_update C:\opensim\INSTANCEb INSTANCEb XXX ::call :DO_update C:\opensim\INSTANCEc INSTANCEc XXX ::call :DO_update C:\opensim\INSTANCEd INSTANCEe XXX ::call :DO_update C:\opensim\INSTANCEe INSTANCEf XXX ::call :DO_update C:\opensim\INSTANCEg INSTANCEh XXX ::call :DO_update C:\opensim\INSTANCEh INSTANCEi XXX :: call :DO_update C:\OPENSIM\SA SA DBUSER DBpassword opensim_sa call :DO_update C:\OPENSIM\OSG OSG DBUSER DBpassword opensim_osg :: :: goto:END :: :: ====================== :: === GET UPDATE LCL === :: ====================== :GET_update_LCL :: COPIES files from your LOCAL REPO C:\MY_COMPILES\BIN for distribution :: if not exist %OS_UPD_REPO%\*.* md %OS_UPD_REPO% :: robocopy %OS_SRC% %OS_UPD_REPO%\bin *.* /MIR :: goto:eof :: :: ====================== :: === GET UPDATE WEB === :: ====================== :GET_update_WEB :: change to the UPDATE REPOSITORY, get the source ZIP file from the web if not exist %OS_UPD_REPO%\*.* md %OS_UPD_REPO% :: ::get the latest current rev ZIP line from Website and write to file cur_rev wget -O%OS_UPD_REPO%\cur_revision.txt %OS_SRC% :: ::get the new / latest zip file as received above wget -nc -i%OS_UPD_REPO%\cur_revision.txt -P%OS_UPD_REPO% :: :: unpack & prep if exist %OS_UPD_REPO%\bin\*.* rmdir /S /Q %OS_UPD_REPO%\bin :: 7za x %OS_UPD_REPO%\*.zip -o%OS_UPD_REPO% -aoa :: if not exist %OS_UPD_REPO%\src_archive\*.* mkdir %OS_UPD_REPO%\src_archive move /Y %OS_UPD_REPO%\*.zip %OS_UPD_REPO%\src_archive :: ECHO "GET_UPDATE_WEB COMPLETED" goto:eof :: :: ======================== :: === PROCESS Upgrades === :: ======================== :DO_update :: set OS_Instance=%1 set DBUSER=%3 set DBPW=%4 set DBNAME=%5 :: :: change dir to OpenSim Instance & delete previous if exist & CREATE bin_NEW for latest version cd %OS_Instance% :: :: generate DB Backup after making sure the directory exists if not exist %OS_Instance%\BACKups\*.* md %OS_Instance% if not exist %OS_Instance%\BACKups\DBsql\*.* md %OS_Instance%\BACKups\DBsql if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OS_Instance%\BACKups\DBsql\%DBNAME%_PRE_upgrade.sql :: if exist %OS_Instance%\bin_NEW\*.* rmdir /S /Q %OS_Instance%\bin_NEW :: :: transfer new upgrade into the new instance robocopy %OS_UPD_REPO%\bin %OS_Instance%\bin_NEW *.* /S :: :: rename the Upgrade ini files in the config-include directory copy /Y %OS_Instance%\bin_NEW\config-include\*.ini %OS_Instance%\bin_NEW\config-include\*.ini.UPG :: copy the original ini files from previous version copy /Y %OS_Instance%\bin\config-include\*.ini %OS_Instance%\bin_NEW\config-include :: :: Transfer the appropriate files over to ready it for operation :: copy /Y %OS_Instance%\bin\Regions\*.* %OS_Instance%\bin_NEW\Regions copy /Y %OS_Instance%\bin\estate_settings.xml %OS_Instance%\bin_NEW\estate_settings.xml copy /Y %OS_Instance%\bin\*.db %OS_Instance%\bin_NEW :: copy /Y %OS_Instance%\bin_NEW\OpenSim.ini %OS_Instance%\bin_NEW\OpenSim.ini.UPG copy /Y %OS_Instance%\bin\OpenSim.ini %OS_Instance%\bin_NEW\OpenSim.ini :: echo "WHEN READY, RENAME \bin to \bin_OLD & RENAME \bin_NEW to \bin" goto:eof :: :: :END
SWITCH OpenSim POST UPGRADE
Here is yet another BatchFile which will automatically flip the instances after an upgrade. It preserves the previous bin directory structure by renaming them to bin_OLD and then renaming bin_NEW to bin.
This works in Conjunction with the UPGRADE & REVERT batch files in this chapter.
Simply drop this batch file into your c:\OS_upgrader directory along with the Upgrade_OS.bat & REVERT_OS.bat
Edit the Batch File and change the PATHS & INSTANCE NAMES
@echo OFF :: :: FILENAME: SWITCH_OS.bat :: AUTHOR: WhiteStar Magic @ OSGrid :: DATE: September.16.2009 :: REVISION: 0.2 :: :: DESCRIPTION: :: :: Upgrades OpenSim Instances from SOURCE Website. :: Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review :: and mods prior to startup. (INI's change so should be reviewed prior to initializing) :: :: INSTALLATION: :: save this script into a convenient folder :: if you have OpenSim Instances, for example O:\OSgrid\instanceA & O:\OSgrid\instanceB :: I suggest installing it in c:\OS_upgrader :: :: RUNNING: :: :: Run with the following command SWITCH_OS.bat :: ( easier to make a shortcut on your desktop to it ) :: can be installed in another directory, Adjust the script accordingly :: :: ================================== :: === PERFORM THE UPGRADE\UPDATE === :: ================================== :: :: you must set the OS_Instance next for EACH INSTANCE :: carefully look at the syntax :: it is the path to the root of the instance to be updated :: call :DO_switch C:\OPENSIM\INSTANCEa call :DO_switch C:\OPENSIM\INSTANCEb call :DO_switch C:\OPENSIM\INSTANCEc call :DO_switch C:\OPENSIM\INSTANCEd call :DO_switch C:\OPENSIM\INSTANCEe :: :: goto:END :: :: ========================= :: === SWITCH TO Upgrade === :: ========================= @echo ON :DO_switch :: set OS_Instance=%1 :: :: change dir to OpenSim Instance & RENAME bin to bin_OLD & RENAME bin_NEW to bin cd %OS_Instance% :: if exist %OS_Instance%\bin_OLD rmdir /S /Q %OS_Instance%\bin_OLD :: rename bin bin_OLD :: rename bin_NEW bin :: goto:eof :: :: :END
UPGRADE REVERSION
As we all know, things happen and sometimes an upgrade, well, isn't meant to be. So with that in mind here is a quick reversion process if you used the above UPGRADE system. This will ONLY WORK IF YOU DID NOT DELETE C:\opensim\Instance?\bin_OLD
SPECIAL NOTE
- This process depends on the fact that you renamed your previous old \bin folder to bin_OLD
- That the INSTANCE(s) IS/ARE SHUTDOWN !!!!!!!!!!!
@echo OFF :: :: FILENAME: REVERT_OS.bat :: AUTHOR: WhiteStar Magic @ OSGrid :: DATE: September.02.2009 :: REVISION: 0.1 (initial release) :: :: DESCRIPTION: :: :: REVERTS OpenSim Instances which have been upgraded (just in case). :: :: INSTALLATION: :: Install this in same folder as the Auto Upgrader C:\OS_upgrader :: :: RUNNING: :: :: Run with the following command REVERT_OS.bat :: ( easier to make a shortcut on your desktop to it ) :: can be installed in another directory, Adjust the script accordingly :: :: ========================================== :: === GENERAL VARIABLES THAT MUST BE SET === :: ========================================== :: :: ======================== :: --- REVERT Instances --- :: ======================== :: :: you must set the OS_Instance next for EACH INSTANCE :: carefully look at the syntax :: it is the path to the root of the instance to be updated :: call :DO_revert C:\opensim\INSTANCEa call :DO_revert C:\opensim\INSTANCEb call :DO_revert C:\opensim\INSTANCEc call :DO_revert C:\opensim\INSTANCEd call :DO_revert C:\opensim\INSTANCEe call :DO_revert C:\opensim\INSTANCEf call :DO_revert C:\opensim\INSTANCEg call :DO_revert C:\opensim\INSTANCEh :: goto:END :: :: ========================= :: === PROCESS REVERSION === :: ========================= :DO_revert :: set OS_Instance=%1 :: :: change dir to OpenSim Instance cd %OS_Instance% :: :: rename the DIRECTORIES rename %OS_Instance%\bin %OS_Instance%\bin_REVERTED rename %OS_Instance%\bin_OLD %OS_Instance%\bin :: goto:eof :: :: :END
BACK-LINKS
Windows
Smart Prestart WIN Backing Up WIN Automated_Upgrade_WIN
Linux
Smart Prestart LINUX Backing Up LINUX Automated Upgrade LINUX