Skip to content
Permalink
Browse files

Ignore error output of log append attempt

  • Loading branch information...
NEMS Linux
NEMS Linux committed Apr 12, 2019
1 parent 66a8266 commit 59e0bc2158a423d8454a958a51dcb3a1761a5392
Showing with 2 additions and 2 deletions.
  1. +1 −1 data/1.5/nagios/plugins/nems_sendmail_host
  2. +1 −1 data/1.5/nagios/plugins/nems_sendmail_service
@@ -541,7 +541,7 @@ if(!$mail->send()) {
echo 'Message could not be sent.' . PHP_EOL;
echo 'Mailer Error: ' . $mail->ErrorInfo . PHP_EOL;
$error = '[' . strtotime('now') . '] NEMS EMAILER: ' . $mail->ErrorInfo . PHP_EOL;
if (!file_put_contents('/var/log/nagios/nagios.log',$error,FILE_APPEND)) {
if (!@file_put_contents('/var/log/nagios/nagios.log',$error,FILE_APPEND)) {
echo 'Could not save log as you are not running as a privileged user.' . PHP_EOL . 'Next time use sudo if this matters to you.';
echo PHP_EOL . $error . PHP_EOL;
}
@@ -568,7 +568,7 @@ if(!$mail->send()) {
echo 'Message could not be sent.' . PHP_EOL;
echo 'Mailer Error: ' . $mail->ErrorInfo . PHP_EOL;
$error = '[' . strtotime('now') . '] NEMS EMAILER: ' . $mail->ErrorInfo . PHP_EOL;
if (!file_put_contents('/var/log/nagios/nagios.log',$error,FILE_APPEND)) {
if (!@file_put_contents('/var/log/nagios/nagios.log',$error,FILE_APPEND)) {
echo 'Could not save log as you are not running as a privileged user.' . PHP_EOL . 'Next time use sudo if this matters to you.';
echo PHP_EOL . $error . PHP_EOL;
}

0 comments on commit 59e0bc2

Please sign in to comment.
You can’t perform that action at this time.