diff --git a/UnitCsvReceiverSmart.pl b/UnitCsvReceiverSmart.pl index ea81111..4c81adb 100644 --- a/UnitCsvReceiverSmart.pl +++ b/UnitCsvReceiverSmart.pl @@ -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); - } - } } } }