--- psinib.pl 2003/03/04 21:08:43 1.8 +++ psinib.pl 2003/07/15 17:40:32 1.9 @@ -107,10 +107,10 @@ my $bl = "$BACKUP_DEST/$host/$dir/latest"; # latest backup my $bc = "$BACKUP_DEST/$host/$dir/$date_dir"; # current one my $real_bl; - if (-e $bl) { + if (-l $bl) { $real_bl=readlink($bl) || die "can't read link $bl: $!"; $real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/"); - if (-e $bc && $real_bl eq $bc) { + if (-l $bc && $real_bl eq $bc) { print "$share allready backuped...\n"; $backup_ok++; next; @@ -204,7 +204,7 @@ my $bc = "$BACKUP_DEST/$host/$dir/$date_dir"; my $real_bl; - if (-e $bl) { + if (-l $bl) { $real_bl=readlink($bl) || die "can't read link $bl: $!"; $real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/"); } else { @@ -225,7 +225,7 @@ } } - if (-e $bc && $real_bl && $real_bl eq $bc) { + if (-l $bc && $real_bl && $real_bl eq $bc) { print "$share allready backuped...\n"; return; } @@ -285,7 +285,7 @@ push @ignore,norm_dir("$d/$_"); } close(I); -print STDERR "ignore: ",join("|",@ignore),"\n"; +#print STDERR "ignore: ",join("|",@ignore),"\n"; link "$real_bl/$d/.backupignore","$bc/$d/.backupignore" || warn "can't copy $real_bl/$d/.backupignore to current backup dir: $!\n"; } @@ -335,9 +335,16 @@ $di = 0; while ($di <= $#smb_dirs) { - my $d=$smb_dirs[$di++]; + my $d=$smb_dirs[$di]; my $pf = norm_dir($d,"smb:$share/"); # path full - my $D = $smb->opendir($pf) || warn "smb->opendir($pf): $!\n"; + my $D = $smb->opendir($pf); + if (! $D) { + xlog($share,"FATAL: $share: $!"); + # remove failing dir + delete $smb_dirs[$di]; + next; + } + $di++; my @clutter = $smb->readdir_struct($D); foreach my $item (@clutter) { @@ -496,7 +503,7 @@ foreach my $f (sort { $file_md5{$a} cmp $file_md5{$b} } keys %file_md5) { my $dir = dirname($f); my $file = basename($f); -#print "$f -- $dir / $file<--\n"; +print "$f -- $dir / $file<--\n"; if ($dir ne $last_dir) { close($md5) if ($md5); open($md5, ">> $bc/$dir/.md5sum") || warn "can't create $bc/$dir/.md5sum: $!"; @@ -509,13 +516,13 @@ # create leatest link #print "ln -s $bc $real_bl\n"; - if (-e $bl) { + if (-l $bl) { unlink $bl || warn "can't remove old latest symlink $bl: $!\n"; } symlink $bc,$bl || warn "can't create latest symlink $bl -> $bc: $!\n"; # FIX: sanity check -- remove for speedup - xlog($share,"failed to create latest symlink...") if (readlink($bl) ne $bc || ! -e $bl); + xlog($share,"failed to create latest symlink $bl -> $bc...") if (readlink($bl) ne $bc || ! -l $bl); xlog($share,"backup completed..."); }