From owner-freebsd-questions Mon Aug 21 12:37:39 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mta06-svc.ntlworld.com (mta06-svc.ntlworld.com [62.253.162.46]) by hub.freebsd.org (Postfix) with ESMTP id 4302D37B424 for ; Mon, 21 Aug 2000 12:37:36 -0700 (PDT) Received: from parish.my.domain ([62.255.98.91]) by mta06-svc.ntlworld.com (InterMail vM.4.01.02.27 201-229-119-110) with ESMTP id <20000821193734.OPBB312.mta06-svc.ntlworld.com@parish.my.domain>; Mon, 21 Aug 2000 20:37:34 +0100 Received: (from mark@localhost) by parish.my.domain (8.9.3/8.9.3) id UAA02010; Mon, 21 Aug 2000 20:37:31 +0100 (BST) (envelope-from mark) Date: Mon, 21 Aug 2000 20:37:31 +0100 From: Mark Ovens To: "Murray's Listserv Account" Cc: freebsd-questions@freebsd.org Subject: Re: how to clip&email last lines of log file Message-ID: <20000821203731.K258@parish> References: <20000821132811.A730@converging.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: <20000821132811.A730@converging.net>; from mgd@brutus.converging.net on Mon, Aug 21, 2000 at 01:28:11PM -0600 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Aug 21, 2000 at 01:28:11PM -0600, Murray's Listserv Account wrote: > I have written a .sh script and use cron to email a log file to my email account > on a daily basis. I could easily delete the previous day's log account > before the current day's log is created but I wish to have a > historical account of the log. Alternatively, I could create two logs: > running and daily and delete the daily... But, I started thinking > about clipping the last lines of a log and emailing the last lines. > For example, the log entries for each day are only 6 lines each. How > do you clip lines from a file. The .sh scripts are run as root and > root uses the csh shell. I do not have the perl port installed. Is > there a shell script/command that would do the job? > tail -6 /path/to/log/file | mail -s "logfile `date '+%Y-%m-%d'`" you@your_domain > Reply-To: > -- > Murray Davis > Converging Technology Solutions > Edmonton, AB > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- 4.4 - The number of the Beastie ________________________________________________________________ 51.44°N FreeBSD - The Power To Serve http://www.freebsd.org 2.057°W My Webpage http://ukug.uk.freebsd.org/~mark mailto:marko@freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message