diff --git a/LoadCSVData.pl b/LoadCSVData.pl index e819de6..9044afc 100755 --- a/LoadCSVData.pl +++ b/LoadCSVData.pl @@ -21,9 +21,9 @@ my $server = 'localhost'; my $db_name = "ase_lar"; my $table = "RAWDATACOR"; my ( @CSVData, @sql ); -my $outcount = 0; -my $outfilenum = 0; -my $maxsqllines = 10000; +my $outcount = 0; +my $outfilenum = 0; +my $maxsqllines = 10000; my ( $tool, $toolbatt, $tooltemp, $tooltype, @channels, @NewData, @ain, @din, @nodetype, $GDEventDate @@ -49,8 +49,8 @@ my $email_addr = 'andrea.carri@aseltd.eu,edoardo.cavalca@aseltd.eu,alessandro.battilani@gmail.com,alessandro.valletta@aseltd.eu'; my $from = 'ASE Alert System'; my ( $email_msg, $email_obj ); -my $G201_fcheck = 0; -my $D2W_fcheck = 0; +my $G201_fcheck = 0; +my $D2W_fcheck = 0; my $FtpToCustomerCmd = 'SendFtpElabData.pl'; my ( $scriptname, $scriptpath ); @@ -162,12 +162,17 @@ sub matlabCalc { } sub trxelab { - my $user = getpwuid($>); - my $ftpcmd = "$scriptpath$FtpToCustomerCmd -m \"$matlab_timestamp\" -u $unit -t $tool >> /home/$user/log/loadcsvdata.log 2>&1"; - print getTimeStamp("log") + my $user = getpwuid($>); + my $ftpcmd = +"$scriptpath$FtpToCustomerCmd -m \"$matlab_timestamp\" -u $unit -t $tool >> /home/$user/log/loadcsvdata.log 2>&1"; + print getTimeStamp("log") . " - pid $$ >> Fork FTP command to set GID mysql: $ftpcmd.\n"; - exec('/usr/bin/sg', 'mysql', "$ftpcmd"); + unless ( fork() ) { + exec( '/usr/bin/sg', 'mysql', "$ftpcmd" ); + exit(0); + } + } sub getNodesType {