summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-10-12 20:49:43 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-10-12 20:49:43 +0000
commit6169dc5330a39dbdb902d3555715010c4cbbcaad (patch)
tree1ef18fc0f7dcb9f62bc2c4d15cd630e6877affe0
parent45f892fe6a27adb55cb7dcbde8caed5bdec2b315 (diff)
downloaddrakx-6169dc5330a39dbdb902d3555715010c4cbbcaad.tar
drakx-6169dc5330a39dbdb902d3555715010c4cbbcaad.tar.gz
drakx-6169dc5330a39dbdb902d3555715010c4cbbcaad.tar.bz2
drakx-6169dc5330a39dbdb902d3555715010c4cbbcaad.tar.xz
drakx-6169dc5330a39dbdb902d3555715010c4cbbcaad.zip
cron: only mail if there's really sg to warn about (aka do not sent
empty mails)
-rwxr-xr-xperl-install/standalone/logdrake13
1 files changed, 8 insertions, 5 deletions
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;