Re: virtual-tape directory error

Tristan Rhodes <[email protected]> Wed, 15 Sep 2004 15:25:46 -0600
Newsgroups gmane.comp.sysutils.backup.sarab
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------040501010506030006000904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello everyone,

Thanks Joseph for helping out with the support of SaraB.  I truly appreciate it.

I suspect the errors we see are caused by the "cut" command.  I have replaced them with their "awk" 
equivalents.

I have created a patch that can be applied to an unmodified sarab.sh from version 0.2.2.  This patch 
also replaces the incorrect $DATE variable with $BASENAME (fixes email reports).  The patch is 
attached to this email.

To apply the patch, copy sarab.patch to the same directory as sarab.sh and run this...

patch sarab.sh sarab.patch

That should update SaraB, and please test it to verify it works.

Thanks,

Tristan Rhodes

Joseph Watson wrote:
> I have seen some problems with "_" and "-" in the file names.  I haven't had
> time to chase it more (but I need to :).  I was thinking this may be the
> same problem.
> 
> Could you try removing the "_" from the rotatoin.schedule and see if it
> works?
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Joergen
> Recke
> Sent: Wednesday, September 15, 2004 2:17 PM
> To: [email protected]
> Subject: [SaraB] virtual-tape directory error
> 
> 
> Hello,
> 
> I run 2 copies of SaraB 0.2.2 on 2 different machines (Debian sarge &
> woody). Except of some paths both copies have the same configuration.
> I'm running simple daily differential backups and a full backup each week:
> 
> ----
> full1
> diff1_1 full1
> diff1_2 full1
> diff1_3 full1
> diff1_4 full1
> diff1_5 full1
> diff1_6 full1
> full2
> diff2_1 full2
> diff2_2 full2
> ...
> ----
> 
> On my sarge everything runs fine. On woody SaraB doesn't get it right.
> The first full works perfect, the first differential not:
> 
> ----
> Top line of rotation.schedule: diff1_1 full1
> Number of fields: 2
> Creating a full-backup on the virtual-tape named: diff1_1 full1
> ...
> Creating virtual-tape directory... mkdir /_backup/diff1_1 full1/
> Moving files to the correct virtual-tape...
> mv /_backup/.sarab_temp_workdir/20040915_1924.1.dar /_backup/diff1_1 full1/
> ERROR: Error when moving the new archive. The attempted command was...
> mv /_backup/.sarab_temp_workdir/* /_backup/diff1_1 full1/
> ----
> 
> Any help would be appreciated.
> Thanks in advance,
> Joergen.
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
> Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
> Camcorder. More prizes in the weekly Lunch Hour Challenge.
> Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
> _______________________________________________
> SaraB-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sarab-discuss
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
> Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
> Camcorder. More prizes in the weekly Lunch Hour Challenge.
> Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
> _______________________________________________
> SaraB-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sarab-discuss
> 

-- 
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.


--------------040501010506030006000904
Content-Type: text/plain;
 name="sarab.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="sarab.patch"

--- sarab.sh.orig	2004-09-15 13:55:16.177219387 -0600
+++ sarab.sh	2004-09-15 15:04:14.513560400 -0600
@@ -54,7 +54,7 @@
     THIS_LINE=$(head -n 1 $SARAB_ETC/$ROTATION_SCHEDULE)
 
    # Get value of the first line, eliminating any comments
-    DATA="$(echo $THIS_LINE | cut -f 1 -d'#')"
+    DATA="$(echo $THIS_LINE | awk -F# '{print $1}')"
     COUNT=1
     
     # Loop until DATA is found or all lines have been processed  
@@ -71,7 +71,7 @@
           THIS_LINE=$(head -n 1 $SARAB_ETC/$ROTATION_SCHEDULE)
 
           # Look for data that is before any comments
-          DATA="$(echo $THIS_LINE | cut -f 1 -d'#')"
+          DATA="$(echo $THIS_LINE | awk -F# '{print $1}')"
 
           # Increment line count 
           let COUNT+=1
@@ -171,12 +171,12 @@
 ## Two fields means this is a diffential/incremental backup, one field means this is a full backup   
 if [ "$NUM_FIELDS" = "2" ]; then
    # First field is the current archive
-   CURRENT_ARCHIVE=$(echo $CURRENT_LINE | cut -f 1 -d" ")
+   CURRENT_ARCHIVE=$(echo $CURRENT_LINE | awk '{print $1}')
    # Second field is the reference archive
-   REFERENCE_ARCHIVE=$(echo $CURRENT_LINE | cut -f 2 -d" ")
+   REFERENCE_ARCHIVE=$(echo $CURRENT_LINE | awk '{print $2}')
    # Test to see if the reference archive actually exists
    if [ -d "$DESTINATION/$REFERENCE_ARCHIVE/" ]; then     # The reference archive exists  
-      REFERENCE_BASENAME="--ref $(/bin/ls $DESTINATION/$REFERENCE_ARCHIVE/*.dar | head -n 1 | cut -f 1 -d".")"
+      REFERENCE_BASENAME="--ref $(/bin/ls $DESTINATION/$REFERENCE_ARCHIVE/*.dar | head -n 1 | awk -F. '{print $1}')"
       # Record information about the reference archive to include in the current archive
       echo "The reference archive for this backup was:" > $DESTINATION/$WORK_DIR/reference_archive.txt
       echo "$(ls -ltr $DESTINATION/$REFERENCE_ARCHIVE/*.dar)" >> $DESTINATION/$WORK_DIR/reference_archive.txt
@@ -373,12 +373,12 @@
 
 ## If notification of success is desired, send notification email
 if [ "$EMAIL_SUCCESS" = "yes" ] && [ "$MAIN_EXIT" = "0" ]; then
-   cat $TEMP_LOG | mail -s "SaraB: Successful backup for $DATE" "$EMAIL_ADDRESS"
+   cat $TEMP_LOG | mail -s "SaraB: Successful backup for $BASENAME" "$EMAIL_ADDRESS"
 fi
 
 ## If notification of failure is desired, send notification email
 if [ "$EMAIL_FAILURE" = "yes" ] && [ "$MAIN_EXIT" != "0" ]; then
-   cat $TEMP_LOG | mail -s "SaraB: Backup failure for $DATE" "$EMAIL_ADDRESS"
+   cat $TEMP_LOG | mail -s "SaraB: Backup failure for $BASENAME" "$EMAIL_ADDRESS"
 fi
 
 # Append temporary log to main log file

--------------040501010506030006000904--


-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m