From owner-freebsd-questions Tue Sep 25 17:59: 5 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtp2.mbox.com.au (smtp2.mbox.com.au [203.103.80.178]) by hub.freebsd.org (Postfix) with ESMTP id 01B3637B41B for ; Tue, 25 Sep 2001 17:59:01 -0700 (PDT) Received: from nms2.mbox.com.au (webmail.i7mail.com.au [192.168.20.4]) by smtp2.mbox.com.au (Sun Internet Mail Server sims.4.0.2000.05.17.04.13.p6) with ESMTP id <0GK8005CWVYJCD@smtp2.mbox.com.au> for freebsd-questions@FreeBSD.ORG; Wed, 26 Sep 2001 08:56:44 +0800 (WST) Received: from mbox.com.au ([127.0.0.1]) by nms2.mbox.com.au (Netscape Messaging Server 4.15) with ESMTP id GK8VYJ02.W66 for ; Wed, 26 Sep 2001 08:56:43 +0800 Date: Wed, 26 Sep 2001 10:56:43 +1000 From: BSD Freak Subject: if then statement with grep To: FreeBSD Questions Message-id: <9131a6912c7d.912c7d9131a6@mbox.com.au> MIME-version: 1.0 X-Mailer: Netscape Webmail Content-type: text/plain; charset=us-ascii Content-language: en Content-disposition: inline Content-transfer-encoding: 7BIT X-Accept-Language: en Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hiya all, This is probably a basic question for most of you, but I have been struggling finding any answers. I want to run a script from /etc/periodic/daily that will search a log file for a certain string and if if found it should send me an e-mail.. The logic should be as follows: if `grep "expected line" /var/log/mylogfile` does NOT return something then mail -s "Alert" me@mycompany.com otherwise don't bother me Thank you all --------------------------------------------------------------------- mBox is unified messaging and now has the mBeeper! Be the first to trial it. http://www.mbox.com.au/mbeeper To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message