From 6169dc5330a39dbdb902d3555715010c4cbbcaad Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 12 Oct 2003 20:49:43 +0000 Subject: cron: only mail if there's really sg to warn about (aka do not sent empty mails) --- perl-install/standalone/logdrake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 4f393a845..8a0d69740 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -379,7 +379,7 @@ sub alert_config() { my $cron = q(#!/usr/bin/perl # generated by logdrake use MDK::Common; -my $r = "*** " . chomp_(`date`) . " ***\n"; +my $r; ); @@ -459,12 +459,15 @@ EOF my $email = ) . "'$email';\n\n"; - $cron .= q(my $F; -open $F, '|/usr/sbin/sendmail -oi -t'; -print $F q(Subject: logdrake Mail Alert + $cron .= q(if ($r) { + my $F; + open $F, '|/usr/sbin/sendmail -oi -t'; + print $F q(Subject: logdrake Mail Alert From: root@localhost To: ), "$email\n"; -print $F $r; + print $F "*** " . chomp_(`date`) . " ***\n"; + print $F $r; +} # EOF); output_with_perm "/etc/cron.hourly/logdrake_service", 0755, $cron; -- cgit v1.2.1