g301 unit

This commit is contained in:
2021-11-13 23:00:45 +01:00
parent 9645a35746
commit 1a1183fa41

View File

@@ -60,7 +60,9 @@ sub getUnitName { # parm => file received ($trfile)
$unit = $strings[1];
}
elsif ( $filenamecsv =~ m/^(\d*_|)G301_ID\d\d\d\d_DT\d\d\d\d$/i ) {
my @strings = $filenamecsv =~ /(.{1,4})_(.{1,6})_(.{1,6}).*/;
my $filecsvname_clean =
substr( $filenamecsv, index( $filenamecsv, "G301" ) );
my @strings = $filecsvname_clean =~ /(.{1,4})_(.{1,6})_(.{1,6}).*/;
$unittype = $strings[0];
$unit = $strings[1];
}
@@ -187,27 +189,6 @@ while ( my $line = $tail->GetLine() ) {
}
exit(0);
}
if ( ( $truser ne 'asega' ) and ( $truser ne 'corra' ) ) {
print getTimeStamp("log")
. " >> Sender user $truser: duplicate as asega user -> load data into DB.\n";
my $realtruser = $truser;
$truser = "asega";
$outpath =~ s/$realtruser/$truser/;
my ( $login, $pass, $uid, $gid ) = getpwnam($truser)
or warn getTimeStamp("log")
. " >> $truser not in passwd file.\n";
unless ( fork() ) {
setgid($gid);
setuid($uid);
$ENV{"HOME"} = 'home/' . $truser;
exec( $scriptpath
. "LoadCSVData.pl -f \"$dest\" -s \"$outpath/SQL/$filename"
. "_"
. "$timestamp.sql\" -d $truser >> /home/$truser/log/loadcsvdata.log 2>&1"
);
exit(0);
}
}
}
}
}