From owner-freebsd-questions Sat Apr 1 17:31:43 2000 Delivered-To: freebsd-questions@freebsd.org Received: from emu.prod.itd.earthlink.net (emu.prod.itd.earthlink.net [207.217.121.31]) by hub.freebsd.org (Postfix) with ESMTP id C97EB37B891 for ; Sat, 1 Apr 2000 17:31:38 -0800 (PST) (envelope-from bduk@earthlink.net) Received: from earthlink.net (sdn-ar-004orportP089.dialsprint.net [63.178.65.177]) by emu.prod.itd.earthlink.net (8.9.3/8.9.3) with ESMTP id RAA06815; Sat, 1 Apr 2000 17:31:36 -0800 (PST) Received: (from bduk@localhost) by earthlink.net (8.9.3/8.9.3) id NAA04182; Sat, 1 Apr 2000 13:50:14 -0800 (PST) (envelope-from bduk) Date: Sat, 1 Apr 2000 13:50:14 -0800 (PST) Posted-Date: Sat, 1 Apr 2000 13:50:14 -0800 (PST) Message-Id: <200004012150.NAA04182@earthlink.net> From: Derrick Baumer To: a.genkin@utoronto.ca Cc: freebsd-questions@FreeBSD.ORG In-reply-to: <874s9ly5k5.fsf@tea.thpoon.com> (message from Arcady Genkin on 01 Apr 2000 14:39:06 -0500) Subject: Re: Rotating apache logs (new logs don't appear) Reply-To: bduk@earthlink.net Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG You need to send HUP to the server. kill -1 `cat /var/run/httpd.pid` Also, read the online documentation that comes with the apache install and check out the frequently asked questions area. > From: Arcady Genkin > > I've set up a cron job to rotate apache access and error logs, but > suspect that there's a fault with my script. > > It's been more than 36 hours since the last rotation, and the new logs > just don't appear (and I know that there has been traffic). Here's > what I came up with for the script: > ,---- > | #! /bin/sh > | # Rename current logs to have today's day of week suffix > | > | ACCESS_LOG=/var/log/apache_access_log > | ERROR_LOG=/var/log/apache_error_log > | > | # set $DAY to day of week > | DAY=`date | awk '{print $1}'` > | > | ACCESS_LOG_DAY=$ACCESS_LOG.$DAY > | ERROR_LOG_DAY=$ERROR_LOG.$DAY > | > | if [ -w $ACCESS_LOG ] > | then > | mv $ACCESS_LOG $ACCESS_LOG.tmp > | # remove all entries for local access > | egrep -v '^192\.168\.[0-9]*\.[0-9]*' $ACCESS_LOG.tmp > $ACCESS_LOG_DAY > | rm -f $ACCESS_LOG.tmp > | fi > | > | if [ -w $ERROR_LOG ] > | then > | mv $ERROR_LOG $ERROR_LOG_DAY > | mail -s "Apache errors log for $DAY" < $ERROR_LOG_DAY webmaster > | fi > `---- > > I suspect that perhaps apache keeps track of the log file as a file > descriptor and doesn't check if the file needs to be re-created when > trying to write to it, but I might be wrong. > > Thanks for any ideas! > -- > Arcady Genkin http://www.thpoon.com > Nostalgia isn't what it used to be. -- Derrick Baumer - Black Duck Software To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message