Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Oct 2001 18:39:10 -0400
From:      Leo Bicknell <bicknell@ufp.org>
To:        hackers@FreeBSD.ORG
Subject:   Re: syslogd and kqueue
Message-ID:  <20011027183910.A46292@ussenterprise.ufp.org>
In-Reply-To: <200110272222.f9RMMeZ76727@gits.dyndns.org>; from clefevre@citeweb.net on Sun, Oct 28, 2001 at 12:22:40AM %2B0200
References:  <20011027043342.A18231@parhelion.firedrake.org> <200110272222.f9RMMeZ76727@gits.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 28, 2001 at 12:22:40AM +0200, Cyrille Lefevre wrote:
> > The traditional log-rotation dance goes something like:
> > 
> > mv log log.0
> > touch log
> 
> never do a mv/touch on a log file to avoid full filled file systems,
> use cp instead...
> 
> cp log log.0
> (there is a delta here which can be handled w/ tail -0 -f)
> cp /dev/null log
> 
> this has the advantage to work w/ every daemons, even the ones wich
> don't handle SIGHUP as well as simple redirections (daemon > log).

Using cp will make you lose log entries.

When a file is renamed, all programs with the file open continue
writing to the new name.  That is, if you run syslog, and then "mv
log log.0", you will now find it writing entries to log.0.  If you
copy, you create a log.0, but syslog is still writing to log.  Thus
any log entries from when cp finishes to when your next {cp/touch}
is run are lost.

-- 
       Leo Bicknell - bicknell@ufp.org - CCIE 3440
        PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011027183910.A46292>