From owner-freebsd-questions@FreeBSD.ORG Wed Nov 26 09:47:53 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EBE816A4CE for ; Wed, 26 Nov 2003 09:47:53 -0800 (PST) Received: from ns1.tiadon.com (SMTP.tiadon.com [69.27.132.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19CF443FAF for ; Wed, 26 Nov 2003 09:47:50 -0800 (PST) (envelope-from kdk@daleco.biz) Received: from daleco.biz ([69.27.131.0]) by ns1.tiadon.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 26 Nov 2003 11:50:45 -0600 Message-ID: <3FC4E747.2000503@daleco.biz> Date: Wed, 26 Nov 2003 11:47:51 -0600 From: "Kevin D. Kinsey, DaleCo, S.P." User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031124 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stuart.gibson@bridgeman.co.uk References: <3FC4D7D4.11526.C30C22@localhost> In-Reply-To: <3FC4D7D4.11526.C30C22@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Nov 2003 17:50:45.0640 (UTC) FILETIME=[D175B080:01C3B445] cc: freebsd-questions@freebsd.org Subject: Re: crontab X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2003 17:47:53 -0000 stuart.gibson@bridgeman.co.uk wrote: >Hi, > >I have a number of scripts that run every night using a crontab. In my >crontab file I'm using the MAILTO flag to get cron to email me every >time it runs which results in a lot of emails. > >Is there any way of instructing cron to only email me if the cron job >fails? > >regards > >Stuart Gibson > > > Sure! Redirect stderror to /dev/null: /bin/sh /home/me/myscript > /dev/null And this one won't mail you, whether it errors or not.... /bin/sh /home/me/myscript > /dev/null 2>&1 Kevin Kinsey DaleCo, S.P.