Listing 2 fssnapdel
#!/usr/bin/bash
#Delete named snapshot as amdump reports its DUMP IS DONE
#JRCB 10-oct-02
#0. Sleep for 5 minutes
#1. Run until snapshot is deleted
#2. List Amanda sendbackup logs in FILES
#3. Delete snapshot if it is completed and exit
#4. Otherwise sleep 5 minutes and try again
set -x
AMANDA_LOG_DIR=/tmp/amanda
DATE=/usr/bin/date
DATESTAMP=`date '+%Y%m%d'`
EGREP=/usr/bin/egrep
FSSNAP=/usr/lib/fs/ufs/fssnap
NAP=300
SNAPDEV=$1
SLEEP=/usr/bin/sleep
cd $AMANDA_LOG_DIR
while $SLEEP $NAP ; do
FILES=sendbackup.$DATESTAMP*.debug
#List logs of completed dumps
#Need space after $SNAPDEV else "Dumping /" matches "Dumping /var" etc
FILE=`$EGREP -l "DUMP: Dumping $SNAPDEV " $FILES`
#Check if SNAPDEV is amongst the DONE DUMPS
if $EGREP -s "DUMP: DUMP IS DONE" $FILE ; then
$FSSNAP -d $SNAPDEV
break
fi
done
|