Backup Dirvish Configurations

 #/bin/bash
 
 #check to make sure we have our dirvish master config files
 #so that we can parse the banks!
 if [ ! -f /etc/dirvish/master.conf ] ; then
         echo "I couldn't find /etc/dirvish/master.conf.  Exiting"
         exit
 fi
 
 ##check to make sure our backup directory exists
 #if [ ! -d /etc/dirvish/vaultbackups ] ; then
 #       mkdir -p /etc/dirvish/vaultbackups
 #fi
 
 
 #set the backup directory location
 BKPDIR=/etc/dirvish/vaultbackups/`date +%F`
 #set the Array count
 COUNT=0
  
 #read in the file 
 while read FILE; do 
         #look for the word bank and start pulling in the following lines as arrays.
         if [ $FOUND ] ; then
                 if echo "$FILE" | grep -q : ; then
                   #We found another option, so turn of line imports
                   unset FOUND
                   continue
                 else
                   BANK[$COUNT]="$FILE"
                   COUNT=$(( $COUNT + 1 ))
                   continue
                 fi
         fi
 
         if echo "$FILE" | grep -q ^bank: ; then
                 FOUND="YES"
                 continue #this ends the processing of this current line of the file
         fi
 done < /etc/dirvish/master.conf
 
 for INSTANCE in ${BANK[@]} ; do
         cd $INSTANCE
         for DI in */dirvish; do
          mkdir -p $BKPDIR$INSTANCE/$DI
          cp -R $DI/default.conf $BKPDIR$INSTANCE/$DI/
         done
 done

BackupDirvishConfigs (last edited 2011-01-24 02:55:28 by pool-72-90-106-232)