close(DUMPOR); close(TEEOR); close(BUFOR); close(FINDOR);
close(DUMPOW); close(TEEOW); close(BUFOW); close(FINDOW);
close(GZOR); close(GZOW);
+ close(DDERRR); close(DDERRW);
}
# work out a find option string that will exclude the required files
pipe(FINDOR,FINDOW) or die $!;
pipe(DUMPOR,DUMPOW) or die $!;
pipe(TEEOR,TEEOW) or die $!;
+ pipe(TEEOR,TEEOW) or die $!;
pipe(BUFOR,BUFOW) or die $!;
+ pipe(DDERRR,DDERRW) or die $!;
$bufir='TEEOR';
- $ddcmd= "dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape";
+ $ddcmd= "dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape 2>&1";
if ($gz) {
$bufir='GZOR';
$ddcmd .= " conv=sync";
}
+ nexttapefile("full $prefix:$atf");
+
# We can back up via dump or cpio or zafio
$dumpin= '</dev/null';
if ($tm eq 'dump') {
# It is roughly equivalent to:
# md5sum <p >>this-md5sums
# dump <$dumpin | tee p [| gzip] | writebuffer | dd >/dev/null
+
startprocess '<p','>>this-md5sums',"$nice md5sum";
startprocess $dumpin,'>&DUMPOW',"$nice ".$rstr.$dumpcmd;
startprocess '<&DUMPOR','>&TEEOW',"$nice tee p";
startprocess '<&TEEOR','>&GZOW',"$nice gzip -v$gz";
}
startprocess "<&$bufir",'>&BUFOW',"$nasty writebuffer";
- startprocess '<&BUFOR','>/dev/null',"$nasty $ddcmd";
+ startprocess '<&DDERRR','>/dev/null',"$nice tee dderr >&2";
+ startprocess '<&BUFOR','>&DDERRW',"$nasty $ddcmd";
closepipes();
endprocesses();
+
+ open DDERR, "dderr" or die $!;
+ defined(read DDERR,$_,1023) or die $!;
+ close DDERR;
+ m/\n(\d+)\+0 records out\n/ or die ">$dderr< ?";
+ push @tapefilesizes, [ $1, $currenttapefilename ];
+ $totalrecords++;
+ pboth("total blocks written so far: $totalrecords");
}
# The backup should now be complete; verify it
$cmd .= " | $nasty readbuffer";
$cmd .= " | $nice gzip -vd" if $gz;
$cmd .= " | $nice md5sum";
- print LOG " $cmd\n" or die $!;
- print " $cmd\n" or die $!;
+ pboth(" $cmd\n");
chomp($csum= `$cmd`);
$csum =~ s/\ +\-?$//;
$orgsum eq $csum or die "MISMATCH $tf $csum $orgsum\n";
setstatus "FAILED during cleanup";
+pboth("summary:");
+foreach $tfs (@tapefilesizes) {
+ pboth(sprintf " %10d blocks for %s\n", $tfs->[0], $tfs->[1]);
+}
+pboth(sprintf " %10d blocks total (of %d bytes) plus TAPEID and headers\n",
+ $totalrecords, $blocksizebytes);
+
# Write to some status files to indicate what the backup system
# ought to do when next invoked.
# reset incremental backup count to 1.