Riformattata mail failed matlab exec

This commit is contained in:
2021-01-06 10:39:50 +01:00
parent a50e06ca9d
commit ec57aaf3d5

View File

@@ -137,17 +137,18 @@ sub matlabCalc {
$matlabOutputError = <$fh>; $matlabOutputError = <$fh>;
} }
close($fh); close($fh);
$matlabOutputError =~ s/\n/<br>/g;
my $exit_value = $? >> 8; my $exit_value = $? >> 8;
if ( $exit_value == 124 ) { if ( $exit_value == 124 ) {
print getTimeStamp("log") print getTimeStamp("log")
. " - pid $$ >> system @args excessive duration: killed after $matlab_timeout seconds\n"; . " - pid $$ >> system @args excessive duration: killed after $matlab_timeout seconds\n";
$matlab_error = $matlab_error =
"Maltab elab excessive duration: killed after $matlab_timeout seconds"; "Matlab elab excessive duration: killed after $matlab_timeout seconds";
} }
else { else {
print getTimeStamp("log") print getTimeStamp("log")
. " - pid $$ >> system @args failed: return code $exit_value - $?\n"; . " - pid $$ >> system @args failed: return code $exit_value - $?\n";
$matlab_error = "Maltab elab failed: $exit_value - $?"; $matlab_error = "Matlab elab failed: $exit_value - $?";
} }
makeEmailMsg(); makeEmailMsg();
emailSend(); emailSend();
@@ -297,7 +298,8 @@ sub getMatlabCmd {
sub makeEmailMsg { sub makeEmailMsg {
$email_msg = <<"END_MSG"; $email_msg = <<"END_MSG";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -307,28 +309,28 @@ sub makeEmailMsg {
<body style="margin: 0; padding: 0;"> <body style="margin: 0; padding: 0;">
<table border="0" cellpadding="0" cellspacing="0" width="100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <tr>
<td> <td align="center">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;">
<tr>
<td align="center" bgcolor="#fff" style="padding: 10px 0 10px 0;">
<img src="https://www2.aseltd.eu/img/logo_ASE_small.png" alt="ASE" style="display: block;" /> <img src="https://www2.aseltd.eu/img/logo_ASE_small.png" alt="ASE" style="display: block;" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td bgcolor="#ffffff" style="padding: 10px 10px 10px 10px;"> <td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%"> <h1 style="margin: 5px;">Alert from ASE:</h1>
</td>
</tr>
<tr> <tr>
<td style="padding: 10px 10px 10px 10px;"> <td align="center">
Alert from ASE: <BR> <h3 style="margin: 5px;">Matlab function $matlab_cmd failed on unit => $unit - tool => $tool</h3>
Matlab function $matlab_cmd failed on unit => $unit - tool => $tool <BR>
$matlabOutputError <BR>
$matlab_error
</td> </td>
</tr> </tr>
</table> <tr>
<td align="center">
<h4 style="margin: 5px;">$matlab_error</h4>
</td> </td>
</tr> </tr>
</table> <tr>
<td style="padding: 20px;">
$matlabOutputError
</td> </td>
</tr> </tr>
</table> </table>