[Veritas-bu] backing up clearcase vobs
2003-09-21 11:48:05
Subject: |
[Veritas-bu] backing up clearcase vobs |
From: |
drt8243 AT hotmail DOT com (David Thome) |
Date: |
Sun, 21 Sep 2003 15:48:05 +0000 |
<html><div style='background-color:'><DIV>
<P>This is the quick and dirty script that I use to lock all the clearcase
vobs, backup the vobs and then unlock them. What Id' like to do is modify
this script in order to</P>
<P>lock one <BR><BR></P></DIV>
<DIV></DIV>>From: Richard Hellier <RLH AT LSIL DOT COM>
<DIV></DIV>>To: veritas-bu AT mailman.eng.auburn DOT edu
<DIV></DIV>>CC: David Thome <DRT8243 AT HOTMAIL DOT COM>
<DIV></DIV>>Subject: Re: [Veritas-bu] backing up clearcase vobs
<DIV></DIV>>Date: Thu, 11 Sep 2003 14:48:32 +0100
<DIV></DIV>>
<DIV></DIV>>David Thome wrote:
<DIV></DIV>> >
<DIV></DIV>> > I understand that if you plan on backing up clearcase
vobs, you need to
<DIV></DIV>> >
<DIV></DIV>> > lock the vob
<DIV></DIV>> > back it up the filesystem
<DIV></DIV>> > unlock it
<DIV></DIV>> >
<DIV></DIV>> > Then go on to the next vob to backup
<DIV></DIV>> >
<DIV></DIV>> > Anyone have a procedure complete with (bpstart_notify and
bpend_notify)
<DIV></DIV>> > scripts?
<DIV></DIV>> >
<DIV></DIV>> > I have 10 vobs to backup.
<DIV></DIV>> >
<DIV></DIV>> > Thank you in advance
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>David,
<DIV></DIV>> The script I use is at the end of the message -- it uses
"cleartool
<DIV></DIV>>lsvob" to get the list of VOBs (i.e. so the script doesn't need
to be
<DIV></DIV>>changed
<DIV></DIV>>if VOBs are added/deleted) and also checks their status before
trying to
<DIV></DIV>>lock/unlock them.
<DIV></DIV>>
<DIV></DIV>>Cheers,
<DIV></DIV>>
<DIV></DIV>>Richard.
<DIV></DIV>>
<DIV></DIV>>----------------------------------- cut here -------------
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>#! /bin/sh
<DIV></DIV>>
<DIV></DIV>>############################################################
<DIV></DIV>>#
<DIV></DIV>># Filename: cc_backup.sh
<DIV></DIV>>#
<DIV></DIV>># Purpose: Backup the ClearCase database
<DIV></DIV>>#
<DIV></DIV>># Last-modified-by: Richard Hellier <RLH AT LSIL DOT COM>
<DIV></DIV>>#
<DIV></DIV>># Last-modified-date: 2001-08-17
<DIV></DIV>>#
<DIV></DIV>># ChangeLog: 2001-08-14 Original version
<DIV></DIV>># 2001-08-17 Altered to save logging info
<DIV></DIV>>#
<DIV></DIV>>############################################################
<DIV></DIV>>
<DIV></DIV>>############################################################
<DIV></DIV>>################### Global Data ############################
<DIV></DIV>>############################################################
<DIV></DIV>>
<DIV></DIV>>PATH=/bin:/usr/ucb:/usr/atria/bin
<DIV></DIV>>IFS="
<DIV></DIV>>"
<DIV></DIV>>
<DIV></DIV>>############################################################
<DIV></DIV>>################### Function Definitions Begin Here ########
<DIV></DIV>>############################################################
<DIV></DIV>>
<DIV></DIV>>############################################################
<DIV></DIV>>######################################### Lock all VOBs before
<DIV></DIV>>######################################### starting a backup
<DIV></DIV>>############################################################
<DIV></DIV>>stop_clearcase()
<DIV></DIV>>{
<DIV></DIV>> for v in ${*}
<DIV></DIV>> do {
<DIV></DIV>> vobStatus=`cleartool describe -fmt "%[locked]p" ${v}`
<DIV></DIV>> case "${vobStatus}" in
<DIV></DIV>> unlocked) cleartool lock ${v}
<DIV></DIV>> echo "Locking VOB ${v}"
<DIV></DIV>> ;;
<DIV></DIV>> esac
<DIV></DIV>> } done
<DIV></DIV>>}
<DIV></DIV>>############################################################
<DIV></DIV>>######################################### Copy all the VOB data
<DIV></DIV>>######################################### to the fileserver
<DIV></DIV>>############################################################
<DIV></DIV>>backup_clearcase()
<DIV></DIV>>{
<DIV></DIV>> DSTDIR="/backup/cc"
<DIV></DIV>> SRCDIR="/disks/home0/ccstg/"
<DIV></DIV>> ITEMS="
<DIV></DIV>>backup
<DIV></DIV>>vobs
<DIV></DIV>>"
<DIV></DIV>> [ -d "${SRCDIR}" ] || echo "No such directory as ${SRCDIR}"
<DIV></DIV>> [ -d "${DSTDIR}" ] || echo "No such directory as ${DSTDIR}"
<DIV></DIV>>
<DIV></DIV>> if cd ${SRCDIR}
<DIV></DIV>> then {
<DIV></DIV>> find ${ITEMS} -depth -print | cpio -pdm ${DSTDIR}
<DIV></DIV>> } fi
<DIV></DIV>>}
<DIV></DIV>>############################################################
<DIV></DIV>>######################################### Unlock all VOBs after
<DIV></DIV>>######################################### finishing a backup
<DIV></DIV>>############################################################
<DIV></DIV>>start_clearcase()
<DIV></DIV>>{
<DIV></DIV>> for v in ${*}
<DIV></DIV>> do {
<DIV></DIV>> vobStatus=`cleartool describe -fmt "%[locked]p" ${v}`
<DIV></DIV>> case "${vobStatus}" in
<DIV></DIV>> locked) cleartool unlock ${v}
<DIV></DIV>> echo "Unlocking VOB ${v}"
<DIV></DIV>> ;;
<DIV></DIV>> esac
<DIV></DIV>> } done
<DIV></DIV>>}
<DIV></DIV>>############################################################
<DIV></DIV>>################### Execution Begins Here ##################
<DIV></DIV>>############################################################
<DIV></DIV>>
<DIV></DIV>>{
<DIV></DIV>>echo "Starting ClearCase backup at "`date`
<DIV></DIV>>#
<DIV></DIV>># Step 1) Make a list of all the VOBs
<DIV></DIV>>#
<DIV></DIV>>vobList=`cleartool lsvob -short | sed -e 's/^/vob:/'`
<DIV></DIV>>#
<DIV></DIV>># Step 2) Lock ClearCase VOBs ...
<DIV></DIV>>#
<DIV></DIV>>stop_clearcase "${vobList}"
<DIV></DIV>>#
<DIV></DIV>># Step 3) ... back'em up ...
<DIV></DIV>>#
<DIV></DIV>>backup_clearcase
<DIV></DIV>>#
<DIV></DIV>># Step 4) ... and unlock 'em again
<DIV></DIV>>#
<DIV></DIV>>start_clearcase "${vobList}"
<DIV></DIV>>#
<DIV></DIV>># Step 5) Exit with zero status code to
<DIV></DIV>># signal success to NetBackup
<DIV></DIV>>#
<DIV></DIV>>echo "Finishing ClearCase backup at "`date`
<DIV></DIV>>
<DIV></DIV>>exit 0
<DIV></DIV>>} >> /var/tmp/cc_backup.log
<DIV></DIV>><< rlh.vcf >>
<DIV></DIV></div><br clear=all><hr> <a
href="http://g.msn.com/8HMBENUS/2734??PS=">Instant message in style with MSN
Messenger 6.0. Download it now FREE!</a> </html>
|
|
|