/[psinib]/psinib.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /psinib.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by dpavlin, Sun Oct 26 14:04:17 2003 UTC revision 1.18 by dpavlin, Mon Oct 27 18:58:41 2003 UTC
# Line 199  sub xlog { Line 199  sub xlog {
199          my $share = shift;          my $share = shift;
200          my $t = strftime $LOG_TIME_FMT, localtime;          my $t = strftime $LOG_TIME_FMT, localtime;
201          my $m = shift || '[no log entry]';          my $m = shift || '[no log entry]';
202          my $l = shift || 1;          my $l = shift;
203            $l = 1 if (! defined $l);       # default verbosity is 1
204          print STDERR $m,"\n" if ($verbose >= $l);          print STDERR $m,"\n" if ($verbose >= $l);
205          print L "$t $share\t$m\n";          print L "$t $share\t$m\n";
206  }  }
207    
208  # dump warn and dies into log  # dump warn and dies into log
209  BEGIN { $SIG{'__WARN__'} = sub { xlog('WARN',$_[0]) ; warn $_[0] } }  BEGIN { $SIG{'__WARN__'} = sub { xlog('WARN',$_[0],1) ; warn $_[0] } }
210  BEGIN { $SIG{'__DIE__'} = sub { xlog('DIE',$_[0]) ; die $_[0] } }  BEGIN { $SIG{'__DIE__'} = sub { xlog('DIE',$_[0],0) ; die $_[0] } }
211    
212    
213  # split share name to host, dir and currnet date dir  # split share name to host, dir and currnet date dir
# Line 248  sub snap_share { Line 249  sub snap_share {
249          if (-l $bl) {          if (-l $bl) {
250                  $real_bl=readlink($bl) || die "can't read link $bl: $!";                  $real_bl=readlink($bl) || die "can't read link $bl: $!";
251                  $real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/");                  $real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/");
252          } else {                  undef $real_bl if (! -e $real_bl);
253            }
254            if (! $real_bl) {
255                  xlog($share,"no old backup, trying to find last backup,");                  xlog($share,"no old backup, trying to find last backup,");
256                  if (opendir(BL_DIR, "$BACKUP_DEST/$host/$dir")) {                  if (opendir(BL_DIR, "$BACKUP_DEST/$host/$dir")) {
257                          my @bl_dirs = sort grep { !/^\./ && -d "$BACKUP_DEST/$host/$dir/$_" } readdir(BL_DIR);                          my @bl_dirs = sort grep { !/^\./ && -d "$BACKUP_DEST/$host/$dir/$_" } readdir(BL_DIR);
# Line 382  sub snap_share { Line 385  sub snap_share {
385                  my $pf = norm_dir($d,"smb:$share/");    # path full                  my $pf = norm_dir($d,"smb:$share/");    # path full
386                  my $D = $smb->opendir($pf);                  my $D = $smb->opendir($pf);
387                  if (! $D) {                  if (! $D) {
388                          xlog($share,"FATAL: $share [$pf]: $!");                          xlog($share,"FATAL: $share [$pf] as $param{username}/$param{workgroup}: $!",0);
389                          # remove failing dir                          # remove failing dir
390                          delete $smb_dirs[$di];                          delete $smb_dirs[$di];
391                          return 0;                       # failed                          return 0;                       # failed

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.26