IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 6, 2011, 2:02:54 PM (15 years ago)
Author:
bills
Message:

fix yet another logic error in magic_destreak_revert.pl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_destreak_revert.pl

    r32048 r32356  
    99my $host = hostname();
    1010my $date = `date`;
    11 print "\n\n";
    12 print "Starting script $0 on $host at $date\n\n";
     11print STDERR "\n\n";
     12print STDERR "Starting script $0 on $host at $date\n\n";
    1313
    1414use vars qw( $VERSION );
     
    413413    if ($backup_is_not_destreaked) {
    414414        if ($original_is_not_destreaked) {
    415             # this is unexpected result. throw an error so this can be checked manually
    416             print STDERR "both files appear to not be destreaked\n";
     415            print STDERR "\nBoth files appear to not be destreaked.\n";
    417416            print STDERR "original: $original\n";
    418417            print STDERR "backup:   $backup\n";
    419418            my $o_basename = basename($o_path);
    420419            my $b_basename = basename($b_path);
     420            # if original file does not have SR_ in basename and the backup does then the
     421            # files are in their original state. Just delete back up file
     422            # otherwise go to failed_revert for manual inspection.
    421423            if (!($o_basename =~ /SR_/) and ($b_basename =~ /SR_/)) {
    422                 print " basenames are as expected it is safe to revert\n";
     424                print STDERR " basenames are as expected it is safe to delete backup file\n";
     425                if (! $ipprc->file_delete($backup, $force)) {
     426                    print STDERR "failed to delete $backup\n";
     427                    return 0;
     428                }
     429                return 1;
    423430            } else {
     431                # this is an unexpected result. throw an error so this can be checked manually
     432                print STDERR " basenames for files are as NOT as expected unsafe to revert\n";
     433                print STDERR " o_basename: $o_basename\n";
     434                print STDERR " b_basename: $b_basename\n";
    424435                return 0;
    425436            }
Note: See TracChangeset for help on using the changeset viewer.