Skip to content

Commit

Permalink
More error handling for nems-mailtest
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Jul 16, 2018
1 parent cc29b4e commit ceb389e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mailtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ if (strlen($CONTACTEMAIL) > 0) {

if (isset($USER5) && $USER5 == $CONTACTEMAIL) $error .= '- You need to send to a different email address: same as sender.' . PHP_EOL;

if (!isset($USER7)) $error .= '- Missing SMTP server in NEMS SST.' . PHP_EOL;
if (!isset($USER9)) $error .= '- Missing SMTP username in NEMS SST.' . PHP_EOL;
if (!isset($USER10)) $error .= '- Missing SMTP password in NEMS SST.' . PHP_EOL;



// Die on errors
if (strlen($error) > 0) die($error . PHP_EOL . 'Aborted.' . PHP_EOL);

Expand All @@ -97,4 +103,5 @@ $command = "/usr/bin/printf \"%b\" \"***** NEMS Test Email *****\n\nNotification
$output = shell_exec($command);
echo $output;
shell_exec('chown nagios:nagios /var/log/sendemail'); // Log gets created as running user. Fix.

?>

0 comments on commit ceb389e

Please sign in to comment.