Veritas-bu

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

<Prev in Thread] Current Thread [Next in Thread>