prova x nuovo nas
This commit is contained in:
@@ -36,7 +36,8 @@ my $password = 'mums';
|
||||
my $lockTS;
|
||||
my $lockfile = '/tmp/retransmit.lock';
|
||||
|
||||
GetOptions( "file=s" => \$readingFile,
|
||||
GetOptions(
|
||||
"file=s" => \$readingFile,
|
||||
"lockts=i" => \$lockTS
|
||||
) or die("Error in command line arguments\n");
|
||||
|
||||
@@ -49,11 +50,13 @@ if (-e $lockfile) {
|
||||
}
|
||||
close($fh);
|
||||
if ( $content != $lockTS ) {
|
||||
print getTimeStamp("log") . " >> timestamp mismatch... $content - $lockTS ... Exiting. \n";
|
||||
print getTimeStamp("log")
|
||||
. " >> timestamp mismatch... $content - $lockTS ... Exiting. \n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
open( FH, '>', $lockfile ) or die $!;
|
||||
print FH $lockTS;
|
||||
close(FH);
|
||||
@@ -82,14 +85,18 @@ if ($ftp->login($username,$password)) {
|
||||
if ( $ftp->put( $readingFile, $tool . $suffix ) ) {
|
||||
print getTimeStamp("log") . " >> Put $readingFile completed.\n";
|
||||
if ( !move $readingFile, $send ) {
|
||||
warn getTimeStamp("log") . " >> Move $readingFile -> $send failed: $!";
|
||||
} else {
|
||||
warn getTimeStamp("log")
|
||||
. " >> Move $readingFile -> $send failed: $!";
|
||||
}
|
||||
else {
|
||||
print getTimeStamp("log") . " >> Moved $readingFile -> $send.\n";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
die getTimeStamp("log") . " >> Put $readingFile failed ", $ftp->message;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
die getTimeStamp("log") . " >> Cannot login ", $ftp->message;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user