From owner-freebsd-hackers Tue Feb 10 15:00:25 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA05985 for hackers-outgoing; Tue, 10 Feb 1998 15:00:25 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from panda.hilink.com.au (panda.hilink.com.au [203.8.15.25]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA05968 for ; Tue, 10 Feb 1998 15:00:10 -0800 (PST) (envelope-from danny@panda.hilink.com.au) Received: (from danny@localhost) by panda.hilink.com.au (8.8.5/8.8.5) id KAA00752; Wed, 11 Feb 1998 10:00:02 +1100 (EST) Date: Wed, 11 Feb 1998 09:59:59 +1100 (EST) From: "Daniel O'Callaghan" To: Joao Carlos Mendes Luis , freebsd-hackers@FreeBSD.ORG Subject: Re: logrotate, a proposal In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 11 Feb 1998, I wrote: > On Tue, 10 Feb 1998, Joao Carlos Mendes Luis wrote: > > Worst, how would I know from the format how to "walk" through the old > > logs and select the older one to delete ? I cannot believe in the file > > date for this. > > In my bourne shell version, I say 'daily' 'weekly' 'monthly' and > calculate the number of days to keep the logs, based on find(1) and mtime. > In a perl version, it walks the directory looking for similarly named > files, and stat(2)s them, looking for files X seconds old, X being > calculated from the number of seconds in a day, and the number of days to > keep the files. The other possibility is to take expiretime = now - expiryseconds, and strftime(3) using expiretime to contruct the name of the file to delete. Try for both plain and .gz forms. Danny To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe hackers" in the body of the message