From owner-freebsd-hackers Thu Dec 21 01:02:33 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA22789 for hackers-outgoing; Thu, 21 Dec 1995 01:02:33 -0800 (PST) Received: from sequent.kiae.su (sequent.kiae.su [144.206.136.6]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA22759 for ; Thu, 21 Dec 1995 01:01:41 -0800 (PST) Received: by sequent.kiae.su id AA24403 (5.65.kiae-2 for hackers@freebsd.org); Thu, 21 Dec 1995 11:59:08 +0300 Received: by sequent.KIAE.su (UUMAIL/2.0); Thu, 21 Dec 95 11:59:08 +0300 Received: (from ache@localhost) by ache.dialup.ru (8.7.3/8.7.3) id LAA02218 for hackers@freebsd.org; Thu, 21 Dec 1995 11:58:25 +0300 (MSK) To: hackers@freebsd.org Message-Id: Organization: Olahm Ha-Yetzirah Date: Thu, 21 Dec 1995 11:58:25 +0300 (MSK) X-Mailer: Mail/@ [v2.41 FreeBSD] From: =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) X-Class: Fast Subject: weekly/monthly logs rotating idea (commit candidate) Lines: 27 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org Precedence: bulk Current logs rotating code ... if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi if [ -f $i ]; then mv -f $i $i.0; fi >$i isn't good for daemons, because thet keep log descriptor open. It means that daemon_log moved to daemon_log.0 and diagnostics still writted to daemon_log.0! New daemon_log leaves zero-sized until reboot. What I suggest: if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi if [ -f $i ]; then cp -fp $i $i.0; fi >$i It means that you copy log preserving file times and then zero the same descriptor. If I not see objections with explanations, I plan to commit it. -- Andrey A. Chernov : And I rest so composedly, /Now, in my bed, ache@astral.msk.su : That any beholder /Might fancy me dead - http://dt.demos.su/~ache : Might start at beholding me, /Thinking me dead. RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849