Subversion Repositories sysadmin_scripts

Rev

Rev 22 | Rev 28 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22 Rev 27
Line 204... Line 204...
204
sub validateTarget {
204
sub validateTarget {
205
   my ( $remoteServer, $remoteStaging, $remoteTarget, $directory, $checksum ) = @_;
205
   my ( $remoteServer, $remoteStaging, $remoteTarget, $directory, $checksum ) = @_;
206
   my $md5sum = `ssh $remoteServer "find '$remoteStaging/$directory' -type f -exec md5sum \\{\\} \\; | cut -d' ' -f1 | sort | md5sum | cut -d' ' -f1"`;
206
   my $md5sum = `ssh $remoteServer "find '$remoteStaging/$directory' -type f -exec md5sum \\{\\} \\; | cut -d' ' -f1 | sort | md5sum | cut -d' ' -f1"`;
207
   chomp $md5sum;
207
   chomp $md5sum;
208
   if ( $checksum eq $md5sum ) {
208
   if ( $checksum eq $md5sum ) {
209
      my $command = "ssh $remoteServer \"mv '$remoteStaging/$directory' '$remoteTarget'\"";
-
 
210
      if ( system( $command ) == 0 ) {
209
      if ( defined ( $config{ 'final procedure' } ) ) {
211
         return 1;
-
 
212
      } else {
-
 
213
         &logit( "Unable to move $directory to $remoteServer:$remoteTarget" );
210
         my $result = &( $config{ 'final procedure' } ) ( $remoteServer, $remoteStaging, $remoteTarget, $directory );
214
         return 0;
211
         &logit( $result ) if ( $result );
215
      }
212
      } # do the final procedure, if it exist
216
   } else {
213
   } else {
217
      &logit( "Invalid checksum moving directory $directory" );
214
      &logit( "Invalid checksum moving directory $directory" );
218
      return 0;
215
      return 0;
219
   }
216
   }
220
}
217
}