Date: Thu, 21 Dec 1995 11:58:25 +0300 (MSK) From: =?KOI8-R?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= (aka Andrey A. Chernov, Black Mage) <ache@astral.msk.su> To: hackers@freebsd.org Subject: weekly/monthly logs rotating idea (commit candidate) Message-ID: <OHn6Ismy68@ache.dialup.ru>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OHn6Ismy68>