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.