Veritas-bu

[Veritas-bu] backing up clearcase vobs

2003-09-11 09:48:32
Subject: [Veritas-bu] backing up clearcase vobs
From: rlh AT lsil DOT com (Richard Hellier)
Date: Thu, 11 Sep 2003 14:48:32 +0100
This is a multi-part message in MIME format.
--------------07CEF91E6571B19CA39D35E7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

David Thome wrote:
> 
> I understand that if you plan on backing up clearcase vobs, you need to
> 
> lock the vob
> back it up the filesystem
> unlock it
> 
> Then go on to the next vob to backup
> 
> Anyone have a procedure complete with (bpstart_notify and bpend_notify)
> scripts?
> 
> I have 10 vobs to backup.
> 
> Thank you in advance


David,
        The script I use is at the end of the message -- it uses "cleartool
lsvob" to get the list of VOBs (i.e. so the script doesn't need to be
changed
if VOBs are added/deleted) and also checks their status before trying to
lock/unlock them.

Cheers,

Richard.

----------------------------------- cut here -------------


#! /bin/sh

############################################################
#
#       Filename:               cc_backup.sh
#
#       Purpose:                Backup the ClearCase database
#
#       Last-modified-by:       Richard Hellier <rlh AT lsil DOT com>
#
#       Last-modified-date:     2001-08-17
#
#       ChangeLog:              2001-08-14 Original version
#                               2001-08-17 Altered to save logging info
#
############################################################

############################################################
################### Global Data ############################
############################################################

PATH=/bin:/usr/ucb:/usr/atria/bin
IFS=" 
"

############################################################
################### Function Definitions Begin Here ########
############################################################

############################################################
######################################### Lock all VOBs before
######################################### starting a backup
############################################################
stop_clearcase()
{
        for v in ${*}
        do {
                vobStatus=`cleartool describe -fmt "%[locked]p" ${v}`
                case "${vobStatus}" in
                        unlocked)       cleartool lock ${v}
                                        echo "Locking VOB ${v}"
                                        ;;
                esac
        } done
}
############################################################
######################################### Copy all the VOB data
######################################### to the fileserver
############################################################
backup_clearcase()
{
        DSTDIR="/backup/cc"
        SRCDIR="/disks/home0/ccstg/"
        ITEMS="
backup
vobs
"
        [ -d "${SRCDIR}" ] || echo "No such directory as ${SRCDIR}"
        [ -d "${DSTDIR}" ] || echo "No such directory as ${DSTDIR}"

        if cd ${SRCDIR}
        then {
                find ${ITEMS} -depth -print | cpio -pdm ${DSTDIR}
        } fi
}
############################################################
######################################### Unlock all VOBs after
######################################### finishing a backup
############################################################
start_clearcase()
{
        for v in ${*}
        do {
                vobStatus=`cleartool describe -fmt "%[locked]p" ${v}`
                case "${vobStatus}" in
                        locked)         cleartool unlock ${v}
                                        echo "Unlocking VOB ${v}"
                                        ;;
                esac
        } done
}
############################################################
################### Execution Begins Here ##################
############################################################

{
echo "Starting ClearCase backup at "`date`
#
#       Step 1) Make a list of all the VOBs
#
vobList=`cleartool lsvob -short | sed -e 's/^/vob:/'`
#
#       Step 2) Lock ClearCase VOBs ...
#
stop_clearcase "${vobList}"
#
#       Step 3) ... back'em up ...
#
backup_clearcase
#
#       Step 4) ... and unlock 'em again
#
start_clearcase "${vobList}"
#
#       Step 5) Exit with zero status code to
#               signal success to NetBackup
#
echo "Finishing ClearCase backup at "`date`

exit 0
} >> /var/tmp/cc_backup.log
--------------07CEF91E6571B19CA39D35E7
Content-Type: text/x-vcard; charset=us-ascii;
 name="rlh.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Richard Hellier
Content-Disposition: attachment;
 filename="rlh.vcf"

begin:vcard 
n:Hellier;Richard
tel;cell:[+44] 7734-335601
tel;fax:[+44] 1344-413114
tel;work:[+44] 1344-413183
x-mozilla-html:FALSE
org:LSI Logic;GES UNIX Europe
version:2.1
email;internet:rlh AT lsil DOT com
adr;quoted-printable:;;Greenwood House=0D=0ALondon Road;Bracknell;BK;RG12 2UB;GB
x-mozilla-cpt:;0
fn:Richard Hellier
end:vcard

--------------07CEF91E6571B19CA39D35E7--