inserito creazione dir config
This commit is contained in:
@@ -105,6 +105,13 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
. " >> Failed to create path: $outpath/SQL";
|
. " >> Failed to create path: $outpath/SQL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !-d "$outpath/config" ) {
|
||||||
|
make_path "$outpath/config",
|
||||||
|
{ mode => 0755, owner => $truser, group => $gid }
|
||||||
|
or warn getTimeStamp("log")
|
||||||
|
. " >> Failed to create path: $outpath/config";
|
||||||
|
}
|
||||||
|
|
||||||
my $timestamp = getTimeStamp();
|
my $timestamp = getTimeStamp();
|
||||||
my $dest = $outpath . "/" . $filename . "_" . $timestamp . $suffix;
|
my $dest = $outpath . "/" . $filename . "_" . $timestamp . $suffix;
|
||||||
if ( !move $trfile, $dest ) {
|
if ( !move $trfile, $dest ) {
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
print getTimeStamp("log") . " >> Unit $unit - Filename $trfile\n";
|
print getTimeStamp("log") . " >> Unit $unit - Filename $trfile\n";
|
||||||
my $outpath = $path . $unit . "/received";
|
my $outpath = $path . $unit . "/received";
|
||||||
my $trnpath = $path . $unit . "/transmitted";
|
my $trnpath = $path . $unit . "/transmitted";
|
||||||
|
my $cfgpath = $path . $unit . "/config";
|
||||||
if ( !-d "$outpath" ) {
|
if ( !-d "$outpath" ) {
|
||||||
make_path "$outpath",
|
make_path "$outpath",
|
||||||
{ mode => 0755, owner => $truser, group => $truser }
|
{ mode => 0755, owner => $truser, group => $truser }
|
||||||
@@ -114,6 +115,12 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
or warn getTimeStamp("log")
|
or warn getTimeStamp("log")
|
||||||
. " >> Failed to create path: $trnpath";
|
. " >> Failed to create path: $trnpath";
|
||||||
}
|
}
|
||||||
|
if ( !-d "$cfgpath" ) {
|
||||||
|
make_path "$cfgpath",
|
||||||
|
{ mode => 0755, owner => $truser, group => $truser }
|
||||||
|
or warn getTimeStamp("log")
|
||||||
|
. " >> Failed to create path: $cfgpath";
|
||||||
|
}
|
||||||
my $timestamp = getTimeStamp();
|
my $timestamp = getTimeStamp();
|
||||||
my $dest = $outpath . "/" . $filename . "_" . $timestamp . $suffix;
|
my $dest = $outpath . "/" . $filename . "_" . $timestamp . $suffix;
|
||||||
my $send = $trnpath . "/" . $filename . "_" . $timestamp . $suffix;
|
my $send = $trnpath . "/" . $filename . "_" . $timestamp . $suffix;
|
||||||
@@ -129,12 +136,13 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
}
|
}
|
||||||
my $ftp = Net::FTP->new(
|
my $ftp = Net::FTP->new(
|
||||||
$hostname,
|
$hostname,
|
||||||
Timeout => 20,
|
Timeout => 10,
|
||||||
Debug => 0,
|
Debug => 0,
|
||||||
Passive => 0
|
Passive => 0
|
||||||
)
|
)
|
||||||
or warn getTimeStamp("log")
|
or warn getTimeStamp("log")
|
||||||
. " >> Cannot connect to $hostname: $@";
|
. " >> Cannot connect to $hostname: $@";
|
||||||
|
if ( defined $ftp ) {
|
||||||
if ( $ftp->login( $username, $password ) ) {
|
if ( $ftp->login( $username, $password ) ) {
|
||||||
if ( $ftp->put( $dest, $filename . $suffix ) ) {
|
if ( $ftp->put( $dest, $filename . $suffix ) ) {
|
||||||
if ( !move $dest, $send ) {
|
if ( !move $dest, $send ) {
|
||||||
@@ -156,6 +164,7 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user