This is pretty sweet. Thanks Jari!

Warm regards,
Jordan Michaels

On 09/23/2011 01:12 AM, Jari Ketola wrote:
I wrote a quick (and somewhat dirty) script for automatically updating
an OpenBD installation to the latest nightly build (under CentOS 5.6).

The script assumes that OpenBD was installed using the Vivio Tech
installer, and basically follows the steps from OpenBD wiki
<http://wiki.openbluedragon.org/wiki/index.php/Upgrading_VivioTech_Installation:Linux>.
It also takes a full copy of the current OpenBD version installed prior
to updating. This may not be a feasible solution for all cases, but
works for me.

Just in case someone else might find it useful as well, I thought I'd
post it to the list. It's also available at
http://dl.dropbox.com/u/4552475/update-openbd-nightly.txt

Comes with no warranty. If it breaks something, you're on your own.

Jari

#!/bin/bash

# Updates OpenBluedragon to latest nightly build
# Backs up the current running version
# Stops and re-starts OpenBD in the process
#
# ref:
# 
http://wiki.openbluedragon.org/wiki/index.php/Upgrading_VivioTech_Installation:Linux
#
# Written by Jari Ketola<@afterdawn.com>  2011/09/22

OPENBD="/opt/openbd"
OPENBDUSER="admin"
OPENBDGROUP="users"
NIGHTLYURL="http://www.openbluedragon.org/download/nightly/openbd.war";
DATE=`date +%Y%m%d`
WARFILE="openbd-nightly-$DATE"
TMPDIR="/tmp/$WARFILE"
BACKUPDIR="/opt/openbd.$DATE"
TMPADMIN="/tmp/obdadmin-$DATE.tar"
TMPMAIN="/tmp/obdmain-$DATE.tar"
ADMINDIRS="bluedragon manual"
MAINDIRS="bin classes customtags lib webresources"
OPENBDSTOP="/etc/init.d/openbd_ctl stop"
OPENBDSTART="/etc/init.d/openbd_ctl start"
RESTARTFLAG="true"

# Create temp dir for unzipping

if [ -d $TMPDIR ]
then
        TMPDIR=`mktemp -d $TMPDIR.XX`
fi
mkdir -p $TMPDIR
cd $TMPDIR

# Download nightly war and unzip

echo Downloading latest OpenBD nightly build from
echo $NIGHTLYURL ...
wget -O "$WARFILE.zip" $NIGHTLYURL || exit 1
mkdir tmp
echo ...
echo Unzippping build ...
unzip -q $WARFILE.zip -d tmp/ || exit 1

# tar directories
cd tmp
echo Compressing OpenBD administrator ...
tar cvf $TMPADMIN $ADMINDIRS>/dev/null || exit 1
echo Compressing OpenBD libraries ...
cd WEB-INF
tar cvf $TMPMAIN $MAINDIRS>/dev/null || exit 1

if [[ $RESTARTFLAG = "true" || $RESTARTFLAG = "yes" ]]
then
        echo Stopping Tomcat process ...
        $OPENBDSTOP
fi

# If backup dir already exists, make a new one
if [ -d $BACKUPDIR ]
then
        BACKUPDIR=`mktemp -d $BACKUPDIR.XX`
fi

echo Backing up $OPENBD to $BACKUPDIR ...
cp -a $OPENBD $BACKUPDIR || exit 1

echo Updating OpenBD ...
cd $OPENBD
tar xvf $TMPMAIN>/dev/null
cd $OPENBD/tomcat/webapps/ROOT
tar xvf $TMPADMIN>/dev/null
chown -R $OPENBDUSER.$OPENBDGROUP $OPENBD

if [[ $RESTARTFLAG = "true" || $RESTARTFLAG = "yes" ]]
then
        echo Starting OpenBD ...
        $OPENBDSTART
fi



--
official tag/function reference: http://openbd.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en

--
official tag/function reference: http://openbd.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to