From owner-freebsd-questions Sun Jan 23 23:14:16 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 7CC9F1525E for ; Sun, 23 Jan 2000 23:14:08 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id BAA64735; Mon, 24 Jan 2000 01:14:02 -0600 (CST) (envelope-from dan) Date: Mon, 24 Jan 2000 01:14:02 -0600 From: Dan Nelson To: Daniel Forsgren Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Disable crontab error mails Message-ID: <20000124011402.A64393@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from "Daniel Forsgren" on Mon Jan 24 07:41:58 GMT 2000 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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