Compare commits
3 Commits
master
...
e4f62ea960
| Author | SHA1 | Date | |
|---|---|---|---|
| e4f62ea960 | |||
| 1a1183fa41 | |||
| 9645a35746 |
@@ -17,7 +17,7 @@ my $username = 'ase_lar';
|
|||||||
my $password = 'laravel';
|
my $password = 'laravel';
|
||||||
my $db_lar = 'ase_lar';
|
my $db_lar = 'ase_lar';
|
||||||
my $db_sp = 'ase_lar';
|
my $db_sp = 'ase_lar';
|
||||||
my $server = 'localhost';
|
my $server = '80.211.107.201';
|
||||||
my $db_name = "ase_lar";
|
my $db_name = "ase_lar";
|
||||||
my $table = "RAWDATACOR";
|
my $table = "RAWDATACOR";
|
||||||
my ( @CSVData, @sql );
|
my ( @CSVData, @sql );
|
||||||
@@ -28,9 +28,8 @@ my (
|
|||||||
$tool, $toolbatt, $tooltemp, $tooltype, @channels,
|
$tool, $toolbatt, $tooltemp, $tooltype, @channels,
|
||||||
@NewData, @ain, @din, @nodetype, $GDEventDate
|
@NewData, @ain, @din, @nodetype, $GDEventDate
|
||||||
);
|
);
|
||||||
my $matlab_proxy_ssh = "localhost"; #"80.211.107.201";
|
my $matlab_proxy_ssh = "80.211.107.201";
|
||||||
my $matlab_proxy_ssh_port = 22; #2222;
|
my $matlab_proxy_ssh_port = 2222;
|
||||||
my $matlab_exec_user = 'asega';
|
|
||||||
my $matlab_cmd = "";
|
my $matlab_cmd = "";
|
||||||
my $matlab_timestamp = "";
|
my $matlab_timestamp = "";
|
||||||
my $ftp_send = 1;
|
my $ftp_send = 1;
|
||||||
@@ -44,7 +43,7 @@ my $duedate = '';
|
|||||||
my ( $unit_id, $unit, $unittype );
|
my ( $unit_id, $unit, $unittype );
|
||||||
my ( $fileDate, $fileTime );
|
my ( $fileDate, $fileTime );
|
||||||
my $matlab_rt = "/usr/local/MATLAB/MATLAB_Runtime/v93";
|
my $matlab_rt = "/usr/local/MATLAB/MATLAB_Runtime/v93";
|
||||||
my $matlab_func_dir = "/usr/local/matlab_func/";
|
my $matlab_func_dir = "/mnt/elab-storage";
|
||||||
my $matlab_error = '';
|
my $matlab_error = '';
|
||||||
my $matlab_timeout = '1800';
|
my $matlab_timeout = '1800';
|
||||||
my $email_addr =
|
my $email_addr =
|
||||||
@@ -54,11 +53,9 @@ my ( $email_msg, $email_obj );
|
|||||||
my $G201_fcheck = 0;
|
my $G201_fcheck = 0;
|
||||||
my $D2W_fcheck = 0;
|
my $D2W_fcheck = 0;
|
||||||
my $G301_fcheck = 0;
|
my $G301_fcheck = 0;
|
||||||
my $CR1000X_fcheck = 0;
|
|
||||||
my $FtpToCustomerCmd = 'SendFtpElabData.pl';
|
my $FtpToCustomerCmd = 'SendFtpElabData.pl';
|
||||||
my ( $scriptname, $scriptpath );
|
my ( $scriptname, $scriptpath );
|
||||||
my $MatlabErrorPath = "/tmp/";
|
my $MatlabErrorFilename = "/mnt/elab-error";
|
||||||
my $MatlabErrorFilename = $MatlabErrorPath;
|
|
||||||
my @matlabOutputErrorArray;
|
my @matlabOutputErrorArray;
|
||||||
my @errors;
|
my @errors;
|
||||||
my @warnings;
|
my @warnings;
|
||||||
@@ -138,17 +135,15 @@ sub matlabCalc {
|
|||||||
#print $ENV{"HOME"} . "\n";
|
#print $ENV{"HOME"} . "\n";
|
||||||
$ENV{"HOME"} = "/" . $ENV{"HOME"};
|
$ENV{"HOME"} = "/" . $ENV{"HOME"};
|
||||||
|
|
||||||
chdir($matlab_func_dir)
|
my $cmd_elab =
|
||||||
or die "cannot change: $!\n";
|
"timeout $matlab_timeout $matlab_cmd $matlab_rt $unit $tool";
|
||||||
print getTimeStamp("log")
|
|
||||||
. " - pid $$ >> current dir: $matlab_func_dir\n";
|
#my $args = "sh -c \'cd $matlab_func_dir; pwd; $cmd_elab\'";
|
||||||
my $args = "timeout $matlab_timeout $matlab_cmd $matlab_rt $unit $tool";
|
|
||||||
|
my $args =
|
||||||
|
"ssh $matlab_proxy_ssh -p $matlab_proxy_ssh_port \"sh -c \'cd $matlab_func_dir; $cmd_elab\'\"";
|
||||||
|
|
||||||
if ( system($args) != 0 ) {
|
if ( system($args) != 0 ) {
|
||||||
my $argscat =
|
|
||||||
"cd $MatlabErrorPath; cat _${unit}_${tool}*_\*_output_error.txt > ${unit}${tool}_output_error.txt";
|
|
||||||
system($argscat);
|
|
||||||
|
|
||||||
open( my $fh, '<', $MatlabErrorFilename )
|
open( my $fh, '<', $MatlabErrorFilename )
|
||||||
or warn print getTimeStamp("log")
|
or warn print getTimeStamp("log")
|
||||||
. " - pid $$ >> Cannot open Matlab output error file: ${MatlabErrorFilename}\n";
|
. " - pid $$ >> Cannot open Matlab output error file: ${MatlabErrorFilename}\n";
|
||||||
@@ -454,9 +449,7 @@ elsif ( $filecsvname =~ m/^(\d*_|)(G301_ID\d\d\d\d_DT\d\d\d\d_\d*)$/i ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ( my $line = <FILE> ) {
|
while ( my $line = <FILE> ) {
|
||||||
|
if ( $line =~ m/\A [[:ascii:]]* \Z/xms ) {
|
||||||
#if ( $line =~ m/\A [[:ascii:]]* \Z/xms ) {
|
|
||||||
if ( $line !~ /\x00/ ) {
|
|
||||||
$line =~ tr /\,/\;/ if ( $line =~ m/^\"\d\d\d\d.*/i ); #CR1000X
|
$line =~ tr /\,/\;/ if ( $line =~ m/^\"\d\d\d\d.*/i ); #CR1000X
|
||||||
$line =~ s/\"//g;
|
$line =~ s/\"//g;
|
||||||
my ( $first, $NodeData ) = split( /;/, $line, 2 );
|
my ( $first, $NodeData ) = split( /;/, $line, 2 );
|
||||||
@@ -553,6 +546,9 @@ while ( my $line = <FILE> ) {
|
|||||||
elsif ( $tooltype eq "CR1000X" )
|
elsif ( $tooltype eq "CR1000X" )
|
||||||
{ # può essere tolto per attivarlo
|
{ # può essere tolto per attivarlo
|
||||||
@CSVData = split( /\|/, $NodeData );
|
@CSVData = split( /\|/, $NodeData );
|
||||||
|
print getTimeStamp("log")
|
||||||
|
. " - pid $$ >> TEST CR1000X Execution ended.\n";
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ( $tooltype eq "MUSA" ) {
|
elsif ( $tooltype eq "MUSA" ) {
|
||||||
|
|||||||
@@ -202,27 +202,6 @@ while ( my $line = $tail->GetLine() ) {
|
|||||||
}
|
}
|
||||||
exit(0);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user