Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2000 20:37:31 +0100
From:      Mark Ovens <marko@freebsd.org>
To:        "Murray's Listserv Account" <mgd@brutus.converging.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how to clip&email last lines of log file
Message-ID:  <20000821203731.K258@parish>
In-Reply-To: <20000821132811.A730@converging.net>; from mgd@brutus.converging.net on Mon, Aug 21, 2000 at 01:28:11PM -0600
References:  <20000821132811.A730@converging.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000821203731.K258>