Automated Upgrade LINUX

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(New page: = Auto-Upgrade for Linux (Multi-Instance) = What it does. Read the Source Code Header of the bash script. Essentially, it grabs the OSG Binary Zip from the website and performs an OpenSi...)
 
Line 3: Line 3:
 
What it does. Read the Source Code Header of the bash script. Essentially, it grabs the OSG Binary Zip from the website and performs an OpenSim Instance Upgrade, transfers the current files and preserves the upgrade INI files as UPG_*.ini so that you can compare them... it will NOT START OPENSIM and OpenSim server MUST BE SHUTDOWN prior to running it.  Refer to [[Smart Prestart LINUX]] for automated Startup & Shutdown scripts to work in tandem with this.  
 
What it does. Read the Source Code Header of the bash script. Essentially, it grabs the OSG Binary Zip from the website and performs an OpenSim Instance Upgrade, transfers the current files and preserves the upgrade INI files as UPG_*.ini so that you can compare them... it will NOT START OPENSIM and OpenSim server MUST BE SHUTDOWN prior to running it.  Refer to [[Smart Prestart LINUX]] for automated Startup & Shutdown scripts to work in tandem with this.  
 
<blockquote><br>#!/bin/bash<br>#<br># FILENAME: Upgrade_OS.sh<br># AUTHOR: WhiteStar Magic @ OSGrid<br># DATE: September 15.09<br># REVISION: 0.3 (3rd prototype)<br>#<br># R.0.3 corrected syntax and added some improvements as suggested by Dene Sparta @ OSG<br># NOTE! This is untested <br>#<br># DESCRIPTION: <br># Based on an initial script by Dene Sparta @ OSG and expanded / modularized.<br># Upgrades OpenSim Instances from SOURCE Website.<br># Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review<br># and mods prior to startup. <br># INI's change so they MUST be reviewed prior to initializing<br>#<br># An Option was added to AUTO-START the Instance AFTER UPGRADE <br>#&nbsp;!! WARNING&nbsp;!! This would start the instance with the Original INI Files from the previous version.<br>#&nbsp;!! The INI files change constantly and should always be reviewed / compared PRIOR to Startup<br>#&nbsp;!! See bottom of === PROCESS Upgrades === section<br>#<br># INSTALLATION:<br># save this script into a convenient folder<br># if you have OpenSim Instances, for example /opensim/instanceA &amp; /opensim/instanceB<br># I suggest installing it in /opensim<br>#<br># RUNNING:<br># Note that BEFORE RUNNING THIS, the Instances MUST BE SHUTDOWN&nbsp;!<br># Run with the following command bash Upgrade_OS.sh<br># can be installed in another directory, Adjust the script accordingly<br>#<br># ======================================================================================<br>#<br># GENERAL VARIABLES THAT MUST BE SET:<br>#<br># where to store your upgrade repository<br>OS_UPD_REPO="/AUTO_UPDATE"<br># website source path<br>OS_WEB_SRC="http://www.osgrid.org/elgg/pg/utilities/autowin" <br># filename to get from website<br>#<br># http://www.osgrid.org/elgg/pg/utilities/autowin shows LATEST Zip File available<br># ======================================================================================<br>#<br># ================<br># === ROUTINES ===<br># ================<br># ======================<br># === PROCESS UPDATE ===<br># ======================<br>GET_update()<br>{<br># --- test to see if backup folders exist, if not make them<br>if [&nbsp;! -e "${OS_UPD_REPO}" ]; then mkdir -v ${OS_UPD_REPO}; fi<br>#<br># change to the UPDATE REPOSITORY, get the source ZIP file from the web <br>cd ${OS_UPD_REPO}<br>#<br>#get the latest current rev ZIP line from OSGrid and write to file cur_rev<br>wget -Ocur_rev ${OS_WEB_SRC}<br>#<br>wget -nc -icur_rev<br>#<br>}<br># ========================<br># === PROCESS Upgrades ===<br># ========================<br>DO_update()<br>{<br># change dir to OpenSim Instance &amp; CREATE bin_NEW for Updated version<br>cd ${OS_Instance}<br>if [&nbsp;! -e "${OS_Instance}/bin_NEW" ] <br>then <br>mkdir -v ${OS_Instance}/bin_NEW<br>else<br>rm -rf ${OS_Instance}/bin_NEW<br>mkdir -v ${OS_Instance}/bin_NEW<br>fi<br>#<br># unpack the new rev to /bin_NEW and move to correct position<br>unzip ${OS_UPD_REPO}/${OS_UPD_NAME} -d ${OS_Instance}/bin_NEW<br>mv -f ${OS_Instance}/bin_NEW/bin ${OS_Instance}/bin_NEW<br>#<br># rename the NEW FILES (ini's etc) files to preserve them for review<br>mv -f ${OS_Instance}/bin_NEW/OpenSim.ini ${OS_Instance}/bin_NEW/UPG_OpenSim.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/FlotsamCache.ini ${OS_Instance}/bin_NEW/config-include/UPG_FlotsamCache.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/Grid.ini ${OS_Instance}/bin_NEW/config-include/UPG_Grid.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/GridCommon.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridCommon.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/GridHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridHypergrid.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/Standalone.ini ${OS_Instance}/bin_NEW/config-include/UPG_Standalone.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/StandaloneHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_StandaloneHypergrid.ini<br>echo "RENAMED the NEW /bin_NEW/config-include/*.INI files to UPG_filename.ini for review"<br>#<br># copy the original ini files from previous version<br>cp -r -u -p ${OS_Instance}/bin/config-include/*.ini ${OS_Instance}/bin/config-include<br>echo "Transfered the ORIGINAL /bin/config-include/*.INI files to /bin_NEW/config-include"<br>#<br># Transfer the appropriate files over to ready it for operation<br>cp -r -u -p ${OS_Instance}/bin/Regions/*.* ${OS_Instance}/bin_NEW/Regions<br>cp ${OS_Instance}/bin/estate_settings.xml ${OS_Instance}/bin_NEW/estate_settings.xml<br>cp ${OS_Instance}/bin/OpenSim.ini ${OS_Instance}/bin_NEW/OpenSim.ini<br>cp ${OS_Instance}/bin/*.db ${OS_Instance}/bin_NEW/*.db<br>echo "Transfered the ORIGINAL Critical files to /bin_NEW"<br>#<br># Now we TAR.GZ the Original bin folder<br>tar --create --gzip --file=${OS_Instance}/${Instance_Name}_OLD_`date +"%Y-%m-%d"`.tar.gz ${OS_Instance}/bin<br>#<br># == ATTENTION == SPECIAL NOTE HERE FOR OPTIONAL COMPLETION ==<br># ============================================================<br>#&nbsp;!!! UNCOMMENT FOLLOWING LINES IF INSTANCES ARE SHUTDOWN AND YOU WISH TO COMPLETE THE SWITCH OVER&nbsp;!!!<br># ============================================================<br>#rm -rf ${OS_Instance}/bin<br>#mv -f ${OS_Instance}/bin_NEW ${OS_Instance}/bin<br>#echo "The New Version prepared to start with UN-REVIEWED INI files"<br>#<br>#echo we are are starting up the OPENSIM Instance in ${OS_Instance}/bin <br>## Uncomment either line below to start appropriate version of OpenSim in screen.<br>#screen -S ${Instance_Name} -d -m mono OpenSim.exe -gui=true<br>#screen -S ${Instance_Name} -d -m mono OpenSim.32BitLaunch.exe -gui=true<br># ============================================================<br>}<br>#<br># ##################################<br># === PERFORM THE UPGRADE/UPDATE ===<br># ==================================<br>#<br>GET_update <br># <br># -------------------------<br># --- Upgrade Instances ---<br># -------------------------<br>#<br>Instance_Name=TEST<br>OS_Instance="/opensim/TEST"<br>DO_update<br>#<br>#&nbsp;!! Repeat and edit as needed&nbsp;!!<br>#<br>#Instance_Name=instanceB<br>#OS_Instance="/opensim/instanceB"<br>#DO_update<br>#<br>#Instance_Name=instanceC<br>#OS_Instance="/opensim/instanceC"<br>#DO_update<br>#<br>#Instance_Name=instanceD<br>#OS_Instance="/opensim/instanceD"<br>#DO_update<br>#<br>################################# </blockquote>
 
<blockquote><br>#!/bin/bash<br>#<br># FILENAME: Upgrade_OS.sh<br># AUTHOR: WhiteStar Magic @ OSGrid<br># DATE: September 15.09<br># REVISION: 0.3 (3rd prototype)<br>#<br># R.0.3 corrected syntax and added some improvements as suggested by Dene Sparta @ OSG<br># NOTE! This is untested <br>#<br># DESCRIPTION: <br># Based on an initial script by Dene Sparta @ OSG and expanded / modularized.<br># Upgrades OpenSim Instances from SOURCE Website.<br># Creates a bin_NEW with the upgraded version and leave original bin intact to allow for review<br># and mods prior to startup. <br># INI's change so they MUST be reviewed prior to initializing<br>#<br># An Option was added to AUTO-START the Instance AFTER UPGRADE <br>#&nbsp;!! WARNING&nbsp;!! This would start the instance with the Original INI Files from the previous version.<br>#&nbsp;!! The INI files change constantly and should always be reviewed / compared PRIOR to Startup<br>#&nbsp;!! See bottom of === PROCESS Upgrades === section<br>#<br># INSTALLATION:<br># save this script into a convenient folder<br># if you have OpenSim Instances, for example /opensim/instanceA &amp; /opensim/instanceB<br># I suggest installing it in /opensim<br>#<br># RUNNING:<br># Note that BEFORE RUNNING THIS, the Instances MUST BE SHUTDOWN&nbsp;!<br># Run with the following command bash Upgrade_OS.sh<br># can be installed in another directory, Adjust the script accordingly<br>#<br># ======================================================================================<br>#<br># GENERAL VARIABLES THAT MUST BE SET:<br>#<br># where to store your upgrade repository<br>OS_UPD_REPO="/AUTO_UPDATE"<br># website source path<br>OS_WEB_SRC="http://www.osgrid.org/elgg/pg/utilities/autowin" <br># filename to get from website<br>#<br># http://www.osgrid.org/elgg/pg/utilities/autowin shows LATEST Zip File available<br># ======================================================================================<br>#<br># ================<br># === ROUTINES ===<br># ================<br># ======================<br># === PROCESS UPDATE ===<br># ======================<br>GET_update()<br>{<br># --- test to see if backup folders exist, if not make them<br>if [&nbsp;! -e "${OS_UPD_REPO}" ]; then mkdir -v ${OS_UPD_REPO}; fi<br>#<br># change to the UPDATE REPOSITORY, get the source ZIP file from the web <br>cd ${OS_UPD_REPO}<br>#<br>#get the latest current rev ZIP line from OSGrid and write to file cur_rev<br>wget -Ocur_rev ${OS_WEB_SRC}<br>#<br>wget -nc -icur_rev<br>#<br>}<br># ========================<br># === PROCESS Upgrades ===<br># ========================<br>DO_update()<br>{<br># change dir to OpenSim Instance &amp; CREATE bin_NEW for Updated version<br>cd ${OS_Instance}<br>if [&nbsp;! -e "${OS_Instance}/bin_NEW" ] <br>then <br>mkdir -v ${OS_Instance}/bin_NEW<br>else<br>rm -rf ${OS_Instance}/bin_NEW<br>mkdir -v ${OS_Instance}/bin_NEW<br>fi<br>#<br># unpack the new rev to /bin_NEW and move to correct position<br>unzip ${OS_UPD_REPO}/${OS_UPD_NAME} -d ${OS_Instance}/bin_NEW<br>mv -f ${OS_Instance}/bin_NEW/bin ${OS_Instance}/bin_NEW<br>#<br># rename the NEW FILES (ini's etc) files to preserve them for review<br>mv -f ${OS_Instance}/bin_NEW/OpenSim.ini ${OS_Instance}/bin_NEW/UPG_OpenSim.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/FlotsamCache.ini ${OS_Instance}/bin_NEW/config-include/UPG_FlotsamCache.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/Grid.ini ${OS_Instance}/bin_NEW/config-include/UPG_Grid.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/GridCommon.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridCommon.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/GridHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridHypergrid.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/Standalone.ini ${OS_Instance}/bin_NEW/config-include/UPG_Standalone.ini<br>mv -f ${OS_Instance}/bin_NEW/config-include/StandaloneHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_StandaloneHypergrid.ini<br>echo "RENAMED the NEW /bin_NEW/config-include/*.INI files to UPG_filename.ini for review"<br>#<br># copy the original ini files from previous version<br>cp -r -u -p ${OS_Instance}/bin/config-include/*.ini ${OS_Instance}/bin/config-include<br>echo "Transfered the ORIGINAL /bin/config-include/*.INI files to /bin_NEW/config-include"<br>#<br># Transfer the appropriate files over to ready it for operation<br>cp -r -u -p ${OS_Instance}/bin/Regions/*.* ${OS_Instance}/bin_NEW/Regions<br>cp ${OS_Instance}/bin/estate_settings.xml ${OS_Instance}/bin_NEW/estate_settings.xml<br>cp ${OS_Instance}/bin/OpenSim.ini ${OS_Instance}/bin_NEW/OpenSim.ini<br>cp ${OS_Instance}/bin/*.db ${OS_Instance}/bin_NEW/*.db<br>echo "Transfered the ORIGINAL Critical files to /bin_NEW"<br>#<br># Now we TAR.GZ the Original bin folder<br>tar --create --gzip --file=${OS_Instance}/${Instance_Name}_OLD_`date +"%Y-%m-%d"`.tar.gz ${OS_Instance}/bin<br>#<br># == ATTENTION == SPECIAL NOTE HERE FOR OPTIONAL COMPLETION ==<br># ============================================================<br>#&nbsp;!!! UNCOMMENT FOLLOWING LINES IF INSTANCES ARE SHUTDOWN AND YOU WISH TO COMPLETE THE SWITCH OVER&nbsp;!!!<br># ============================================================<br>#rm -rf ${OS_Instance}/bin<br>#mv -f ${OS_Instance}/bin_NEW ${OS_Instance}/bin<br>#echo "The New Version prepared to start with UN-REVIEWED INI files"<br>#<br>#echo we are are starting up the OPENSIM Instance in ${OS_Instance}/bin <br>## Uncomment either line below to start appropriate version of OpenSim in screen.<br>#screen -S ${Instance_Name} -d -m mono OpenSim.exe -gui=true<br>#screen -S ${Instance_Name} -d -m mono OpenSim.32BitLaunch.exe -gui=true<br># ============================================================<br>}<br>#<br># ##################################<br># === PERFORM THE UPGRADE/UPDATE ===<br># ==================================<br>#<br>GET_update <br># <br># -------------------------<br># --- Upgrade Instances ---<br># -------------------------<br>#<br>Instance_Name=TEST<br>OS_Instance="/opensim/TEST"<br>DO_update<br>#<br>#&nbsp;!! Repeat and edit as needed&nbsp;!!<br>#<br>#Instance_Name=instanceB<br>#OS_Instance="/opensim/instanceB"<br>#DO_update<br>#<br>#Instance_Name=instanceC<br>#OS_Instance="/opensim/instanceC"<br>#DO_update<br>#<br>#Instance_Name=instanceD<br>#OS_Instance="/opensim/instanceD"<br>#DO_update<br>#<br>################################# </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:06, 15 September 2009

Auto-Upgrade for Linux (Multi-Instance)

What it does. Read the Source Code Header of the bash script. Essentially, it grabs the OSG Binary Zip from the website and performs an OpenSim Instance Upgrade, transfers the current files and preserves the upgrade INI files as UPG_*.ini so that you can compare them... it will NOT START OPENSIM and OpenSim server MUST BE SHUTDOWN prior to running it.  Refer to Smart Prestart LINUX for automated Startup & Shutdown scripts to work in tandem with this.


#!/bin/bash
#
# FILENAME: Upgrade_OS.sh
# AUTHOR: WhiteStar Magic @ OSGrid
# DATE: September 15.09
# REVISION: 0.3 (3rd prototype)
#
# R.0.3 corrected syntax and added some improvements as suggested by Dene Sparta @ OSG
# NOTE! This is untested
#
# DESCRIPTION:
# Based on an initial script by Dene Sparta @ OSG and expanded / modularized.
# 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 they MUST be reviewed prior to initializing
#
# An Option was added to AUTO-START the Instance AFTER UPGRADE
# !! WARNING !! This would start the instance with the Original INI Files from the previous version.
# !! The INI files change constantly and should always be reviewed / compared PRIOR to Startup
# !! See bottom of === PROCESS Upgrades === section
#
# INSTALLATION:
# save this script into a convenient folder
# if you have OpenSim Instances, for example /opensim/instanceA & /opensim/instanceB
# I suggest installing it in /opensim
#
# RUNNING:
# Note that BEFORE RUNNING THIS, the Instances MUST BE SHUTDOWN !
# Run with the following command bash Upgrade_OS.sh
# can be installed in another directory, Adjust the script accordingly
#
# ======================================================================================
#
# GENERAL VARIABLES THAT MUST BE SET:
#
# where to store your upgrade repository
OS_UPD_REPO="/AUTO_UPDATE"
# website source path
OS_WEB_SRC="http://www.osgrid.org/elgg/pg/utilities/autowin"
# filename to get from website
#
# http://www.osgrid.org/elgg/pg/utilities/autowin shows LATEST Zip File available
# ======================================================================================
#
# ================
# === ROUTINES ===
# ================
# ======================
# === PROCESS UPDATE ===
# ======================
GET_update()
{
# --- test to see if backup folders exist, if not make them
if [ ! -e "${OS_UPD_REPO}" ]; then mkdir -v ${OS_UPD_REPO}; fi
#
# change to the UPDATE REPOSITORY, get the source ZIP file from the web
cd ${OS_UPD_REPO}
#
#get the latest current rev ZIP line from OSGrid and write to file cur_rev
wget -Ocur_rev ${OS_WEB_SRC}
#
wget -nc -icur_rev
#
}
# ========================
# === PROCESS Upgrades ===
# ========================
DO_update()
{
# change dir to OpenSim Instance & CREATE bin_NEW for Updated version
cd ${OS_Instance}
if [ ! -e "${OS_Instance}/bin_NEW" ]
then
mkdir -v ${OS_Instance}/bin_NEW
else
rm -rf ${OS_Instance}/bin_NEW
mkdir -v ${OS_Instance}/bin_NEW
fi
#
# unpack the new rev to /bin_NEW and move to correct position
unzip ${OS_UPD_REPO}/${OS_UPD_NAME} -d ${OS_Instance}/bin_NEW
mv -f ${OS_Instance}/bin_NEW/bin ${OS_Instance}/bin_NEW
#
# rename the NEW FILES (ini's etc) files to preserve them for review
mv -f ${OS_Instance}/bin_NEW/OpenSim.ini ${OS_Instance}/bin_NEW/UPG_OpenSim.ini
mv -f ${OS_Instance}/bin_NEW/config-include/FlotsamCache.ini ${OS_Instance}/bin_NEW/config-include/UPG_FlotsamCache.ini
mv -f ${OS_Instance}/bin_NEW/config-include/Grid.ini ${OS_Instance}/bin_NEW/config-include/UPG_Grid.ini
mv -f ${OS_Instance}/bin_NEW/config-include/GridCommon.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridCommon.ini
mv -f ${OS_Instance}/bin_NEW/config-include/GridHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_GridHypergrid.ini
mv -f ${OS_Instance}/bin_NEW/config-include/Standalone.ini ${OS_Instance}/bin_NEW/config-include/UPG_Standalone.ini
mv -f ${OS_Instance}/bin_NEW/config-include/StandaloneHypergrid.ini ${OS_Instance}/bin_NEW/config-include/UPG_StandaloneHypergrid.ini
echo "RENAMED the NEW /bin_NEW/config-include/*.INI files to UPG_filename.ini for review"
#
# copy the original ini files from previous version
cp -r -u -p ${OS_Instance}/bin/config-include/*.ini ${OS_Instance}/bin/config-include
echo "Transfered the ORIGINAL /bin/config-include/*.INI files to /bin_NEW/config-include"
#
# Transfer the appropriate files over to ready it for operation
cp -r -u -p ${OS_Instance}/bin/Regions/*.* ${OS_Instance}/bin_NEW/Regions
cp ${OS_Instance}/bin/estate_settings.xml ${OS_Instance}/bin_NEW/estate_settings.xml
cp ${OS_Instance}/bin/OpenSim.ini ${OS_Instance}/bin_NEW/OpenSim.ini
cp ${OS_Instance}/bin/*.db ${OS_Instance}/bin_NEW/*.db
echo "Transfered the ORIGINAL Critical files to /bin_NEW"
#
# Now we TAR.GZ the Original bin folder
tar --create --gzip --file=${OS_Instance}/${Instance_Name}_OLD_`date +"%Y-%m-%d"`.tar.gz ${OS_Instance}/bin
#
# == ATTENTION == SPECIAL NOTE HERE FOR OPTIONAL COMPLETION ==
# ============================================================
# !!! UNCOMMENT FOLLOWING LINES IF INSTANCES ARE SHUTDOWN AND YOU WISH TO COMPLETE THE SWITCH OVER !!!
# ============================================================
#rm -rf ${OS_Instance}/bin
#mv -f ${OS_Instance}/bin_NEW ${OS_Instance}/bin
#echo "The New Version prepared to start with UN-REVIEWED INI files"
#
#echo we are are starting up the OPENSIM Instance in ${OS_Instance}/bin
## Uncomment either line below to start appropriate version of OpenSim in screen.
#screen -S ${Instance_Name} -d -m mono OpenSim.exe -gui=true
#screen -S ${Instance_Name} -d -m mono OpenSim.32BitLaunch.exe -gui=true
# ============================================================
}
#
# ##################################
# === PERFORM THE UPGRADE/UPDATE ===
# ==================================
#
GET_update
#
# -------------------------
# --- Upgrade Instances ---
# -------------------------
#
Instance_Name=TEST
OS_Instance="/opensim/TEST"
DO_update
#
# !! Repeat and edit as needed !!
#
#Instance_Name=instanceB
#OS_Instance="/opensim/instanceB"
#DO_update
#
#Instance_Name=instanceC
#OS_Instance="/opensim/instanceC"
#DO_update
#
#Instance_Name=instanceD
#OS_Instance="/opensim/instanceD"
#DO_update
#
#################################

BACK-LINKS

Windows

Smart Prestart WIN Backing Up WIN Automated Upgrade WIN

Linux

Smart Prestart LINUX Backing Up LINUX Automated Upgrade LINUX

Personal tools
General
About This Wiki