richiamo matlab eseguibile linux
This commit is contained in:
@@ -6,6 +6,7 @@ use Getopt::Long;
|
|||||||
use Net::FTP;
|
use Net::FTP;
|
||||||
use List::Util qw( max );
|
use List::Util qw( max );
|
||||||
use Data::Dumper qw(Dumper);
|
use Data::Dumper qw(Dumper);
|
||||||
|
use Cwd;
|
||||||
|
|
||||||
$|++; # Autoflush
|
$|++; # Autoflush
|
||||||
|
|
||||||
@@ -36,6 +37,8 @@ my $ftp_parm;
|
|||||||
my $ftp_filename;
|
my $ftp_filename;
|
||||||
my $ftp_target;
|
my $ftp_target;
|
||||||
my $unit_id;
|
my $unit_id;
|
||||||
|
my $matlab_rt = "/usr/local/MATLAB/MATLAB_Runtime/v93";
|
||||||
|
my $matlab_func_dir = "/usr/local/matlab_func/";
|
||||||
|
|
||||||
sub getTimeStamp
|
sub getTimeStamp
|
||||||
{ # parm [ts] => timestamp for filename; log => timestamp for log
|
{ # parm [ts] => timestamp for filename; log => timestamp for log
|
||||||
@@ -104,12 +107,23 @@ sub matlabCalc {
|
|||||||
getMatlabCmd();
|
getMatlabCmd();
|
||||||
$matlab_timestamp = getTimeStamp("db_ts");
|
$matlab_timestamp = getTimeStamp("db_ts");
|
||||||
print getTimeStamp("log") . " - pid $$ >> $tool MatLab calc started...\n";
|
print getTimeStamp("log") . " - pid $$ >> $tool MatLab calc started...\n";
|
||||||
my @out_matlab = `ssh1 $matlab_ip 'cmd /c $matlab_cmd ' $tool`;
|
if ($matlab_cmd =~ /_lnx$/) {
|
||||||
print getTimeStamp("log")
|
$matlab_cmd = './run_' . $matlab_cmd . '.sh';
|
||||||
. " - pid $$ >> $tool MatLab calc executed: $out_matlab[-1]";
|
#print $ENV{"HOME"} . "\n";
|
||||||
|
$ENV{"HOME"} = "/" . $ENV{"HOME"};
|
||||||
#print getTimeStamp("log") . " - @out_matlab";
|
chdir($matlab_func_dir)
|
||||||
#print getTimeStamp("log") . " - pid $$ >> $out_matlab[-1]";
|
or die "cannot change: $!\n";
|
||||||
|
my @args = ( $matlab_cmd, $matlab_rt, $tool);
|
||||||
|
system(@args) == 0
|
||||||
|
or die( getTimeStamp("log") . " - pid $$ >> system @args failed: $?\n" );
|
||||||
|
} else {
|
||||||
|
$matlab_cmd = 'matlab_' . $matlab_cmd . '.cmd';
|
||||||
|
my @out_matlab = `ssh1 $matlab_ip 'cmd /c $matlab_cmd ' $tool`;
|
||||||
|
print getTimeStamp("log")
|
||||||
|
. " - pid $$ >> $tool MatLab calc executed: $out_matlab[-1]\n";
|
||||||
|
#print getTimeStamp("log") . " - @out_matlab";
|
||||||
|
#print getTimeStamp("log") . " - pid $$ >> $out_matlab[-1]";
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,13 +323,11 @@ sub getMatlabCmd {
|
|||||||
. " - pid $$ >> No tool's matlab function selected.\n";
|
. " - pid $$ >> No tool's matlab function selected.\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $mfunc;
|
|
||||||
while ( my $results = $sth->fetchrow_hashref ) {
|
while ( my $results = $sth->fetchrow_hashref ) {
|
||||||
$mfunc = uc $results->{'matcall'};
|
$matlab_cmd = $results->{'matcall'};
|
||||||
$ftp_send = $results->{'ftp_send'};
|
$ftp_send = $results->{'ftp_send'};
|
||||||
$unit_id = $results->{'unit_id'};
|
$unit_id = $results->{'unit_id'};
|
||||||
}
|
}
|
||||||
$matlab_cmd = 'matlab_' . $mfunc . '.cmd';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
|
|||||||
Reference in New Issue
Block a user