Because of the way the perl script /etc/cron.hourly/diskcheck.pl is
written, by first creating a temp file and then emailing it, it will send
an empty email if the filesystem where the $tempfile is to be created fills
up. In rpm versions prior to diskcheck-3.1.1-10.6x, the $tempfile was
created in /tmp. If /tmp filled up, root received an empty email.
In the current rpm diskcheck-3.1.1-10.6x version, if /var were to fill up,
you'd also get an empty email.
This is from /etc/diskcheck.conf:
# Location and name for a temp file
$tempfile = '/var/spool/cron/diskusagealert.txt';
Suggest instead of creating the $tempfile and then mailing it, create the
mail message in a local variable and then pipe that to the mail program.
You'd do something like this in a shell bash script:
# existing code to determine what filesystem is what percent full.
$msg = "The $filesystem is $percentage % full"
echo $msg | /bin/mail root
This should avoid the prior security issues with the $tempfile and allow
you get an informative email when a filesystem is nearing capacity or is
I'm not a perl programmer but if I have time, I might attempt to rewrite
diskcheck and post it here.
I just put a package in http://people.redhat.com/timp/RPMS which fixes the
problem. Let me know if this works or not.
I installed your package, ran the following to fill up /var:
# dd if=/dev/zero of=/var/bigfile
df now shows /var now at 100%
No recipient addresses found in header
What is your $mailto set to in /etc/diskchek.conf? I'm able to send the mail
just fine when doing a quick test as a regular user who doesn't have permission
to write to /var/spool.
PS- the reason I haven't tested with a full var is because it's taking a while
to fill it up for me. It will get tested though.
# Who to mail to...
$mailto = "root";
Might also mention I'm on a i386 RedHat 5.2 box with all the official RH
updates. And if it makes any difference:
I build the sendmail pkgs from RH rawhide SRPMS via 'rpm --rebuild'
[root@rhwsa036 ~]# rpm -qa | grep sendmail
I built the perl 5.005 pkgs from RH 6.2 SRPMS via 'rpm --rebuild'
[root@rhwsa036 ~]# rpm -qa | grep perl
Shouldn't matter. Change the mailto to this: "root\@localhost"
That should do it.
Please let me know if the change in mailto makes it work and I'll change it in
The problem is that when /var fills up completely (100%), sendmail has no room
to write to /var/spool/mail and it produces the "No recipient addresses found in
header" message. You also don't get the email message either, obviously. If
/var does not fill to 100%, diskcheck.pl functions correctly and you do get an
email when /var approaches capacity.
I'd suggest shipping the updated RPM (the one from
http://people.redhat.com/timp/RPMS/diskcheck-3.1.1-12.noarch.rpm ) with the
following in /etc/diskcheck.pl:
# Who to mail to...
Thanks alot for the speedy response on this low priority issue. You guys Rock!
Have a great day Tim!