Send mail only if change (only moderately successful).

This commit is contained in:
hjp 2006-08-14 08:14:42 +00:00
parent 3836ca8c1c
commit d41157029d
1 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,8 @@
use strict;
use Getopt::Std;
use Digest::MD5 qw(md5_hex);
my $time=time;
my @time=localtime($time);
my $hostname;
@ -69,7 +71,15 @@ sub warnmsg {
my $comp = -A $timestamp;
#print STDERR "comp = $comp\n";
if ($comp > 5) {
my $msg1 = $msg;
$msg1 =~ s/( noch \d)([.\d]*)( MB )/$1 . "x" x length($2) . $3/e;
my $digest = md5_hex($msg1);
unless (-f "/var/tmp/quotacheck/$digest") {
sendmail($user, $msg, $mount);
mkdir("/var/tmp/quotacheck");
my $f;
open ($f, ">", "/var/tmp/quotacheck/$digest") && print $f "x";
}
}
}
}