| 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 |
&logit( "checksums match" );
|
209 |
&logit( $directory, $config{'log suffix'}, "checksums match" );
|
| 210 |
return 1;
|
210 |
return 1;
|
| 211 |
} else {
|
211 |
} else {
|
| 212 |
&logit( "Invalid checksum moving directory $directory" );
|
212 |
&logit( $directory, $config{'error suffix'}, "Invalid checksum moving directory $directory" );
|
| 213 |
return 0;
|
213 |
return 0;
|
| 214 |
}
|
214 |
}
|
| 215 |
}
|
215 |
}
|
| 216 |
|
216 |
|
| 217 |
# simple little logger that records some information
|
217 |
# simple little logger that records some information
|
| Line 372... |
Line 372... |
| 372 |
&logit( $dirname, $config{'error suffix'}, "Unable to validate target for $dirname" );
|
372 |
&logit( $dirname, $config{'error suffix'}, "Unable to validate target for $dirname" );
|
| 373 |
}
|
373 |
}
|
| 374 |
}
|
374 |
}
|
| 375 |
|
375 |
|
| 376 |
if ( defined ( $config{ 'final procedure' } ) ) {
|
376 |
if ( defined ( $config{ 'final procedure' } ) ) {
|
| - |
|
377 |
my $command = 'ssh ' . $config{'target server'};
|
| 377 |
my $dirs = &runRemoteCommand( $config{'target server'},"ls -p $config{target server}/$config{target staging area} | grep /" );
|
378 |
$command .= " 'ls -p $config{'target staging area'} | grep /'";
|
| - |
|
379 |
#print "$command\n";
|
| - |
|
380 |
my $dirs = qx/$command/;
|
| 378 |
my @dirs = split( "\n", $dirs );
|
381 |
my @dirs = split( "\n", $dirs );
|
| 379 |
foreach my $thisDir ( @dirs ) {
|
382 |
foreach my $thisDir ( @dirs ) {
|
| - |
|
383 |
$thisDir =~ s'/$'';
|
| 380 |
my $result = $config{ 'final procedure' }->( $remoteServer, $remoteStaging, $remoteTarget, $directory );
|
384 |
my $result = $config{ 'final procedure' }->( $config{'target server'}, $config{'target staging area'}, $config{'target final directory'}, $thisDir );
|
| 381 |
&logit( $result ) if ( $result );
|
385 |
&logit( $thisDir, $config{'log suffix'}, $result ) if ( $result );
|
| 382 |
}
|
386 |
}
|
| 383 |
} # do the final procedure, if it exist
|
387 |
} # do the final procedure, if it exist
|
| 384 |
|
388 |
|
| 385 |
|
389 |
|
| 386 |
|
390 |
|