Problem with etc/periodic/daily/310.accounting

Garrett Cooper gcooper at FreeBSD.org
Tue Feb 22 15:57:15 UTC 2011


On Mon, Feb 21, 2011 at 11:28 PM, Doug Barton <dougb at dougbarton.us> wrote:
> Ignore my last.
>
> The problem is that if /var/account/acct disappears then accounting stops.
> The attached is better, albeit more complicated. It also has the pleasant
> side effect of cleaning up /etc/rc.d/accounting a bit.
>
> I've confirmed that with this patch nothing is lost while the file is being
> switched:
>
> unlink   -    root       pts/2   0.006 secs Mon Feb 21 23:23
> sa       -    root       pts/2   0.014 secs Mon Feb 21 23:23
> gzip     -    root       pts/2   0.014 secs Mon Feb 21 23:23
> sh       -    root       pts/2   0.099 secs Mon Feb 21 23:23
> unlink   -    root       pts/2   0.006 secs Mon Feb 21 23:23
> accton   -    root       pts/2   0.006 secs Mon Feb 21 23:23
> ln       -    root       pts/2   0.006 secs Mon Feb 21 23:23
> mv       -    root       pts/2   0.007 secs Mon Feb 21 23:23
> accton   -    root       pts/2   0.011 secs Mon Feb 21 23:23

    Can accounting_file by provided by user input (doesn't look like
it today, but just to be safe I thought I should check)? If so then
the dirname should be restored. Example:

$ foo=/a/b//////c
$ echo ${foo%/*}
/a/b/////
$ dirname $foo
/a/b

Thanks,
-Garrett


More information about the freebsd-hackers mailing list