Hello Ellen
I renamed temporarily wtmp.1 and i run the script with "set-x" to see
what is going on:
# ./$HOME/Debian/Packages/acct/debian/acct.cron.monthly
+ test -x /usr/sbin/accton
+ echo
####################################################################
+ echo ################# LOGIN ACCOUNTING MONTHLY REPORT
##################
+ echo
####################################################################
+ echo
+ date
+ echo Login accounting for the month ended mié 13 ene 2021 23:09:40
CET:
+ echo
+ test -f /var/log/wtmp.1
+ test -f /var/log/wtmp.1.gz
+ echo Data contained in current wtmp file:
+ ac -p
+ sort -nr -k2
+ echo
+ last
+ chown root:adm /var/log/wtmp.report
+ chmod 640 /var/log/wtmp.report
Could you check this on your machine, please.
Thanks for your bug report.
Greetings,
Marcos.
Thanks for your bug report.
El dom, 01-11-2020 a las 11:03 -0800, Ellen Wang escribió:
> Package: acct
> Version: 6.6.4-2
>
> On a newly installed system, /etc/cron.monthly/acct complains:
>
> /etc/cron.monthly/acct:
> couldn't open file '': No such file or directory
> last: cannot open : No such file or directory
>
> The problem is that the script wants to use /var/log/wtmp.1 instead
> of
> wtmp if logrotate exists, on the assumption that logrotate has
> already
> moved wtmp to wtmp.1. However, this is not true if wtmp is not big
> enough to have been rotated.
>
> This patch gets rid of the error:
>
> --- /etc/cron.monthly/acct# 2018-08-23 09:01:38.000000000 -0700
> +++ /etc/cron.monthly/acct 2020-11-01 10:13:58.310091356 -0800
> @@ -33,7 +33,10 @@
>
> gunzip -c /var/log/wtmp.1.gz > "${WTMP}"
> fi
> + fi
>
> + if [ -n "${WTMP}" ]
> + then
> ac -f "${WTMP}" -p | sort -nr -k2 >>
> /var/log/wtmp.report
> echo >> /var/log/wtmp.report
> last -f "${WTMP}" >> /var/log/wtmp.report
>
> Perhaps a better fix would be to fall back to wtmp.1 only if wtmp is
> empty. Alternatively, if we want a monthly report that covers
> exactly
> one month, then not specifying minsize in /etc/logrotate.d/wtmp is
> the
> solution.
>