Date: Tue, 22 Feb 2011 09:31:30 +0100 From: Daniel Gerzo <danger@FreeBSD.org> To: freebsd-hackers@freebsd.org Subject: Re: Problem with etc/periodic/daily/310.accounting Message-ID: <4D637462.7000807@FreeBSD.org> In-Reply-To: <4D6323D9.5090500@dougbarton.us> References: <4D6323D9.5090500@dougbarton.us>
next in thread | previous in thread | raw e-mail | index | archive | help
On 22.2.2011 3:47, Doug Barton wrote: > I was looking over etc/periodic/daily/310.accounting on a system that is > very tight on space in /var, and I think that at minimum there is a > race, and at best there is a pretty serious inefficiency. > > Right now after rotating the old logs the script does this: > > cp -pf acct acct.0 || rc=3 > sa -s $daily_accounting_flags || rc=3 > > case "$daily_accounting_compress" in > [Yy][Ee][Ss]) > gzip -f acct.0 || rc=3;; > esac > > To start with, the cp is a problem on a space-constrained system > especially when the log is very large. However I think that doing it > this way also introduces a race where events that are logged between the > cp and the sa run are not backed up in acct.0. ITSM that the proper > procedure is: > > mv acct acct.0 || rc=3 I think you should at least `touch acct' here. > case "$daily_accounting_compress" in > [Yy][Ee][Ss]) > gzip --keep -f acct.0 || rc=3;; > esac > > sa -s $daily_accounting_flags acct.0 && unlink acct.0 || rc=3 > > Can anyone see why that would be wrong? If there is no objection, I'll > be committing the attached patch. > > > Doug -- S pozdravom / Best regards Daniel Gerzo, FreeBSD committer
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D637462.7000807>