Nice idea++ Though I think that calculating and re-calculating an MD5 until you get a match might be rather expensive.
A cheaper alternative would be to append the length of the file: filename.ext.123456. That way, a simple -s of the file will tell if it has been fully transferred.
That would make the monitoring script very simple. All that would be needed is something like:
#! perl -slw
use strict;
my $sharePath = '...';
while( 1 ) {
for( glob $sharePath . "IN/*" ) {
my( $filename, $expected ) = m[/([^/]+)\.(\d+)$];
if( $expected == -s ) {
rename $_, "$sharePath/$filename";
system 1,
qq[theProcessingScript.pl <$sharePath/$filename >$sharePath/OUT/$file
+name];
}
}
sleep 1;
}
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|