IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38684 for trunk/tools


Ignore:
Timestamp:
Aug 26, 2015, 3:57:07 PM (11 years ago)
Author:
watersc1
Message:

"final" version. I think I have all the checks correct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/stsci_disks/p4_restore.pl

    r38683 r38684  
    8383
    8484
    85 # my $logDest = "neb://any/stsci_shuffle/restore/${host}.${volume}/${source}.${volume}/${dir}.log.${time}";
    86 # my $ipprc = PS::IPP::Config->new( "GPC1" ) or die "Could not create config object.\n";
    87 # $ipprc->redirect_output($logDest) or die "Could not redirect output to logfile ${logDest}\n";
     85my $logDest = "neb://any/stsci_shuffle/restore/${host}.${volume}/${source}.${volume}/${dir}.log.${time}";
     86my $ipprc = PS::IPP::Config->new( "GPC1" ) or die "Could not create config object.\n";
     87$ipprc->redirect_output($logDest) or die "Could not redirect output to logfile ${logDest}\n";
    8888
    8989my $root = "/export/${host}.${volume}/stsci_shuffle/${source}.${source_vol}/nebulous/${dir}";
     
    142142        if (-e $destination_f) {
    143143            print "FILE ALREADY FOUND\n";
     144            next;
    144145        }
    145         system("stat ${f}");
     146
     147        my $validate_ins_id_query = "SELECT * FROM instance WHERE vol_id = ${source_vol_id} AND ins_id = ${ins_id}";
     148        my @instances = $dbh->selectall_arrayref( $validate_ins_id_query );
     149        if ($#instances != 0) { # We expect one instance on the source
     150            print "NO DB ENTRY\n";
     151            next;
     152        }
     153#       print "PASSED DB CHECK: $#instances\n";
     154#       system("stat ${f}");
    146155        system("mv ${f} ${destination_f}");
    147         system("stat ${destination_f}");
     156#       system("stat ${destination_f}");
    148157
    149158        # Register database change:
     
    153162        }
    154163       
    155 
    156164        $query = $dbh->prepare( $sql->update_instance_uri );
    157165        $query->execute( $local_vol_id, $db_uri, $ins_id );
    158166        $query->finish;
    159         die;
    160     }
    161 }
     167#       die;
     168    } # END loop over files
     169    rmdir($subdir);
     170} # END loop over subdirectories
     171rmdir($root);
    162172
Note: See TracChangeset for help on using the changeset viewer.