Automated Upgrade WIN
From OpenSimulator
(New page: = 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...) |
|||
Line 39: | Line 39: | ||
'''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<br>::<br>:: FILENAME: REVERT_OS.bat<br>:: AUTHOR: WhiteStar Magic @ OSGrid<br>:: DATE: September.02.2009<br>:: REVISION: 0.1 (initial release)<br>::<br>:: DESCRIPTION: <br>::<br>:: REVERTS OpenSim Instances which have been upgraded (just in case).<br>::<br>:: INSTALLATION:<br>:: Install this in same folder as the Auto Upgrader C:\OS_upgrader<br>::<br>:: RUNNING:<br>:: <br>:: Run with the following command REVERT_OS.bat <br>:: ( easier to make a shortcut on your desktop to it )<br>:: can be installed in another directory, Adjust the script accordingly<br>::<br>:: ==========================================<br>:: === GENERAL VARIABLES THAT MUST BE SET ===<br>:: ==========================================<br>::<br>:: ========================<br>:: --- REVERT Instances ---<br>:: ========================<br>::<br>:: you must set the OS_Instance next for EACH INSTANCE <br>:: carefully look at the syntax<br>:: it is the path to the root of the instance to be updated<br>::<br>call :DO_revert C:\opensim\INSTANCEa<br>call :DO_revert C:\opensim\INSTANCEb<br>call :DO_revert C:\opensim\INSTANCEc<br>call :DO_revert C:\opensim\INSTANCEd<br>call :DO_revert C:\opensim\INSTANCEe<br>call :DO_revert C:\opensim\INSTANCEf<br>call :DO_revert C:\opensim\INSTANCEg<br>call :DO_revert C:\opensim\INSTANCEh<br>::<br>goto:END<br>::<br>:: =========================<br>:: === PROCESS REVERSION ===<br>:: =========================<br>:DO_revert <br>::<br>set OS_Instance=%1<br>::<br>:: change dir to OpenSim Instance <br>cd %OS_Instance%<br>::<br>:: rename the DIRECTORIES<br>rename %OS_Instance%\bin %OS_Instance%\bin_REVERTED<br>rename %OS_Instance%\bin_OLD %OS_Instance%\bin<br>::<br>goto:eof<br>::<br>::<br>:END </blockquote> | <blockquote><br>@echo OFF<br>::<br>:: FILENAME: REVERT_OS.bat<br>:: AUTHOR: WhiteStar Magic @ OSGrid<br>:: DATE: September.02.2009<br>:: REVISION: 0.1 (initial release)<br>::<br>:: DESCRIPTION: <br>::<br>:: REVERTS OpenSim Instances which have been upgraded (just in case).<br>::<br>:: INSTALLATION:<br>:: Install this in same folder as the Auto Upgrader C:\OS_upgrader<br>::<br>:: RUNNING:<br>:: <br>:: Run with the following command REVERT_OS.bat <br>:: ( easier to make a shortcut on your desktop to it )<br>:: can be installed in another directory, Adjust the script accordingly<br>::<br>:: ==========================================<br>:: === GENERAL VARIABLES THAT MUST BE SET ===<br>:: ==========================================<br>::<br>:: ========================<br>:: --- REVERT Instances ---<br>:: ========================<br>::<br>:: you must set the OS_Instance next for EACH INSTANCE <br>:: carefully look at the syntax<br>:: it is the path to the root of the instance to be updated<br>::<br>call :DO_revert C:\opensim\INSTANCEa<br>call :DO_revert C:\opensim\INSTANCEb<br>call :DO_revert C:\opensim\INSTANCEc<br>call :DO_revert C:\opensim\INSTANCEd<br>call :DO_revert C:\opensim\INSTANCEe<br>call :DO_revert C:\opensim\INSTANCEf<br>call :DO_revert C:\opensim\INSTANCEg<br>call :DO_revert C:\opensim\INSTANCEh<br>::<br>goto:END<br>::<br>:: =========================<br>:: === PROCESS REVERSION ===<br>:: =========================<br>:DO_revert <br>::<br>set OS_Instance=%1<br>::<br>:: change dir to OpenSim Instance <br>cd %OS_Instance%<br>::<br>:: rename the DIRECTORIES<br>rename %OS_Instance%\bin %OS_Instance%\bin_REVERTED<br>rename %OS_Instance%\bin_OLD %OS_Instance%\bin<br>::<br>goto:eof<br>::<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:04, 15 September 2009
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: September.15.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)
:: 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 O:\OSgrid\instanceA & O:\OSgrid\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://osgrid.org/download/?dir=.&sort_by=changed&sort_as=asc
:: for latest ZIP Binary from OSGrid
::
:: shows ONLY LATEST Zip File available
:: http://www.osgrid.org/elgg/pg/utilities/autowin
::
::
:: where to store your upgrade repository
set OS_UPD_REPO=O:\OS_upgrader
::
:: website source path to get the Binary ZIP
- This path can be directed to another server or LOCALIZED Binary Repository
set OS_SRC=http://www.osgrid.org/elgg/pg/utilities/autowin
::
:: ==================================
:: === PERFORM THE UPGRADE\UPDATE ===
:: ==================================
::
call :GET_update
::
:: =========================
:: --- 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 of us 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\INSTANCEf INSTANCEg XXX
call :DO_update C:\opensim\INSTANCEg INSTANCEh XXX
call :DO_update C:\opensim\INSTANCEh INSTANCEi XXX
::
::
goto:END
::
:: ======================
:: === PROCESS UPDATE ===
:: ======================
:GET_update
:: change to the UPDATE REPOSITORY, get the source ZIP file from the web
if not exist %OS_UPD_REPO%\*.* md %OS_UPD_REPO%
md %OS_UPD_REPO%
::
::get the latest current rev ZIP line from OSGrid and write to file cur_rev
wget -Ocur_revision.txt %OS_SRC%
- COMMENT OUT ABOVE IF COPYING FROM A LOCALIZED REPOSITORY, UNCOMMENT NEXT LINE
- robocopy %OS_SRC% %OS_UPD_REPO% *.zip
::
::get the new / latest zip file as received above
wget -nc -icur_revision.txt
:: COMMENT OUT ABOVE LINE IF COPIED FROM LOCAL REPOSITORYecho WHEN READY, RENAME \bin to \bin_OLD & RENAME \bin_NEW to \bin
:: unpack & prep
if exist %OS_UPD_REPO%\bin_NEW\*.* rmdir /S /Q %OS_UPD_REPO%\bin_NEW
if exist %OS_UPD_REPO%\bin\*.* rmdir /S /Q %OS_UPD_REPO%\bin
::
7za x *.zip -aoa
rename bin bin_NEW
::
if not exist %OS_UPD_REPO%\src_archive\*.* mkdir %OS_UPD_REPO%\src_archive
move /Y *.zip %OS_UPD_REPO%\src_archive
::
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%\BACKup\*.* md %OS_Instance%\BACKup
if not exist %OS_Instance%\BACKup\DBsql\*.* md %OS_Instance%\BACKup\DBsql
if DBUSER NEQ XXX mysqldump --opt -u%DBUSER% -p%DBPW% %DBNAME% > %OS_Instance%\BACKup\DBsql\%DBNAME%.sql
::
if exist %OS_Instance%\bin_NEW\*.* rmdir /S /Q %OS_Instance%\bin_NEW
mkdir %OS_Instance%\bin_NEW
::
:: transfer new upgrade into the new instance
robocopy %OS_UPD_REPO%\bin_NEW %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 %OS_Instance%\bin\Regions\*.* %OS_Instance%\bin_NEW\Regions
copy %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
::
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