modificata mail con in vio errori

This commit is contained in:
2021-01-01 17:21:18 +01:00
parent 268e367c20
commit a50e06ca9d
2 changed files with 13 additions and 1 deletions

View File

@@ -53,6 +53,8 @@ my $G201_fcheck = 0;
my $D2W_fcheck = 0;
my $FtpToCustomerCmd = 'SendFtpElabData.pl';
my ( $scriptname, $scriptpath );
my $MatlabErrorFilename = "/tmp/";
my $matlabOutputError = '';
sub getTimeStamp
{ # parm [ts] => timestamp for filename; log => timestamp for log
@@ -116,6 +118,7 @@ sub matlabCalc {
. " - pid $$ >> $unit - $tool MatLab calc started...\n";
if ( $matlab_cmd =~ /_lnx$/ ) {
$matlab_cmd = './run_' . $matlab_cmd . '.sh';
$MatlabErrorFilename .= "${unit}${tool}_output_error.txt";
#print $ENV{"HOME"} . "\n";
$ENV{"HOME"} = "/" . $ENV{"HOME"};
@@ -126,6 +129,14 @@ sub matlabCalc {
my @args =
( 'timeout', $matlab_timeout, $matlab_cmd, $matlab_rt, $unit, $tool );
if ( system(@args) != 0 ) {
open( my $fh, '<', $MatlabErrorFilename )
or warn print getTimeStamp("log")
. " - pid $$ >> Cannot open Matlab output error file: ${MatlabErrorFilename}\n";
{
local $/;
$matlabOutputError = <$fh>;
}
close($fh);
my $exit_value = $? >> 8;
if ( $exit_value == 124 ) {
print getTimeStamp("log")
@@ -310,6 +321,7 @@ sub makeEmailMsg {
<td style="padding: 10px 10px 10px 10px;">
Alert from ASE: <BR>
Matlab function $matlab_cmd failed on unit => $unit - tool => $tool <BR>
$matlabOutputError <BR>
$matlab_error
</td>
</tr>