Date: Mon, 24 Jan 2000 01:14:02 -0600 From: Dan Nelson <dnelson@emsphone.com> To: Daniel Forsgren <forda@ite.mh.se> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Disable crontab error mails Message-ID: <20000124011402.A64393@dan.emsphone.com> In-Reply-To: <Pine.GSO.4.21.0001240731230.2706-100000@oden>; from "Daniel Forsgren" on Mon Jan 24 07:41:58 GMT 2000 References: <Pine.GSO.4.21.0001240731230.2706-100000@oden>
index | next in thread | previous in thread | raw e-mail
In the last episode (Jan 24), Daniel Forsgren said:
> I've set up a series of crontab scripts that updates a web page with
> system information for a cluster of FreeBSD machines (top, df etc for
> each machine). On each machine there's a script that periodically
> updates its sysinfo text file to the local disk, and the machine with
> the web server runs a script that periodically copies these local
> sysinfo files to the www folder through NFS (all disks are mounted on
> the web server). Now, the problem is that if one machine happen to be
> down, I get a bundle of error mails from cron since one of the disks
> it tries to copy from is not mounted. Is there some way to disable
> error mails from cron? Or could I incorporate some kind of "if the
> file exists"-check in the script?
Yes, on both counts. To make a cron entry completely mute, add
>/dev/null 2>&1
to the end fo the cron line, or to make a whole bunch of lines mute,
add the line
MAILTO=""
before the entries. What I would do, though, is something like this:
for i in host1 host2 host3 ; do
if ping -c 1 $host > /dev/null ; then
do stuff with the host named in $i
fi
done
That will only process hosts that respond to a ping (ping returns a
nonzero code if the host doesn't reply).
--
Dan Nelson
dnelson@emsphone.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000124011402.A64393>
