Resend:
On 2015-02-06 Fri 19:37 PM |, Craig Skinner wrote:
> Produces:-
>
> $ ls -lh /var/account
> total 8472
> -rw-r--r-- 1 root wheel 2.7M Feb 6 19:20 acct
> -rw-r--r-- 1 root wheel 187K Feb 6 01:30 acct.bak.0.gz
> -rw-r--r-- 1 root wheel 206K Feb 5 01:30 acct.bak.1.gz
> -rw-r--r-- 1 root wheel 175K Feb 4 01:30 acct.bak.2.gz
> -rw-r--r-- 1 root wheel 215K Feb 3 01:30 acct.bak.3.gz
> -rw-r--r-- 1 root wheel 185K Feb 2 01:30 acct.bak.4.gz
> -rw-r--r-- 1 root wheel 188K Feb 1 01:30 acct.bak.5.gz
> -rw-r--r-- 1 root wheel 184K Jan 31 01:30 acct.bak.6.gz
> -rw-r--r-- 1 root wheel 64.0K Feb 6 01:30 savacct
> -rw-r--r-- 1 root wheel 32.0K Feb 6 01:30 usracct
>
>
> Via an epoch newsyslog entry & force it in daily after copying to .bak
>
> A zero sized file is skipped (accounting previously turned off).
>
>
> Diffs:-
>
> Index: daily
> ===================================================================
> RCS file: /cvs/src/etc/daily,v
> retrieving revision 1.82
> diff -u -p -r1.82 daily
> --- daily 17 Nov 2014 18:19:08 -0000 1.82
> +++ daily 6 Feb 2015 19:23:26 -0000
> @@ -1,3 +1,4 @@
> +:
> #
> # $OpenBSD: daily,v 1.82 2014/11/17 18:19:08 deraadt Exp $
> # From: @(#)daily 8.2 (Berkeley) 1/25/94
> @@ -65,13 +66,16 @@ fi
> #fi
>
> next_part "Purging accounting records:"
> -if [ -f /var/account/acct ]; then
> - mv -f /var/account/acct.2 /var/account/acct.3
> - mv -f /var/account/acct.1 /var/account/acct.2
> - mv -f /var/account/acct.0 /var/account/acct.1
> - cp -f /var/account/acct /var/account/acct.0
> +acct='/var/account/acct'
> +[[ -f ${acct} && -s ${acct} ]] &&
> +{
> + cp -pf ${acct} ${acct}.bak &&
> + {
> + newsyslog -F ${acct}.bak
> + rm ${acct}.bak
> + }
> sa -sq
> -fi
> +}
>
> # If ROOTBACKUP is set to 1 in the environment, and
> # if filesystem named /altroot is type ffs and mounted "xx",
> Index: newsyslog.conf
> ===================================================================
> RCS file: /cvs/src/etc/newsyslog.conf,v
> retrieving revision 1.33
> diff -u -p -r1.33 newsyslog.conf
> --- newsyslog.conf 27 Aug 2014 13:46:32 -0000 1.33
> +++ newsyslog.conf 6 Feb 2015 19:23:26 -0000
> @@ -16,3 +16,4 @@
> /var/log/pflog 600 3 250 * ZB "pkill
> -HUP -u root -U root -t - -x pflogd"
> /var/www/logs/access.log 644 4 * $W0 Z "pkill -USR1 -u
> root -U root -x httpd"
> /var/www/logs/error.log 644 7 250 * Z "pkill
> -USR1 -u root -U root -x httpd"
> +/var/account/acct.bak 644 7 * @19700101
> ZB
>
>