From owner-freebsd-isp Tue May 18 19:59:24 1999 Delivered-To: freebsd-isp@freebsd.org Received: from roble.com (roble.com [199.108.85.50]) by hub.freebsd.org (Postfix) with ESMTP id 967D2150C9 for ; Tue, 18 May 1999 19:59:22 -0700 (PDT) (envelope-from sendmail@roble.com) Received: from roble2.roble.com (roble2.roble.com [199.108.85.52]) by roble.com (Roble1b) with SMTP id TAA07180 for ; Tue, 18 May 1999 19:59:26 -0700 (PDT) Date: Tue, 18 May 1999 19:59:19 -0700 (PDT) From: Roger Marquis To: freebsd-isp@FreeBSD.ORG Subject: Re: Web Statistics break up program. In-Reply-To: <19990518172622.C1539@futuresouth.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > This will create an archived logfile (http.site.May_1999) and erase > > the original without needing to kill -1 the httpd. > > > > #!/bin/sh - > > LOGDIR=/var/log > > ARCDIR=/var/log/oldlogs > > DAY=`date | awk '{ OFS="_" ;print $2,$6}' ` > > for log in $LOGDIR/http* ; do > > cp $log $ARCDIR/${log}.${DAY} > > chmod 440 $ARCDIR/${log}.${DAY} > > cp /dev/null $log > > done > > Egads!! > That's a pretty vicious race condition there, you'll lose records on busy > servers. In theory perhaps, in reality it doesn't. I've never seen this algorithm fail, even when used on log files that grow by several megabytes per day. -- Roger Marquis Roble Systems Consulting http://www.roble.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message