Cron.weekly and logwatch issue

I have logwatch configured to run daily and runs fine.

I’m testing out running it weekly, so made simple changes to logwatch.conf and then moved 0logwatch from cron.daily to cron.weekly, but it fails to run, and nothing in the /var/log/cron as well.

I pretty sure I could fix this by just adding a regular cron job not called by anacron, but what am I missing here?

The run-parts is in /etc/anacrontab

[root@alma8-p cron.weekly]# pwd
[root@alma8-p cron.weekly]# ls -l
total 4
-rwxr-xr-x. 1 root root 434 Oct 12  2019 0logwatch

[root@alma8-p cron.weekly]# cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

# the maximal random delay added to the base delay of the jobs
# the jobs will be started during the following hours only

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

I missed this, so it’s running it, the mystery is why I’m not getting the emails, all I did was move 0logwatch from /etc/cron.daily to /etc/weekly, I was fully expecting it to work, emails received perfectly fine when run daily.

Running it manually and it sends the email just fine.

Also, there is nothing in the maillog for the weekly, but plenty for daily.

cron-20211114:Nov 11 03:44:03 alma8-p run-parts[195154]: (/etc/cron.weekly) finished 0logwatch

Wondering if this is the culprit in 0logwatch

#but some are only for the nightly cronrun such as --output mail and should be set here.

Default/sterile file has the line below

OPTIONS="--output mail"

Where as on the one with the issue it’s commented out

#OPTIONS="--output mail

This could be, and is most likely my fault, I’ll update when I’ve completed testing.

Yep, user error!

When you install logwatch it creates /usr/share/logwatch/default.conf/logwatch.conf and its associated 0logwatch daily file.

I had altered the above logwatch.conf to send email in text format and to root and that was about it, all worked great, only if you want to run it daily.

To run it weekly I copied the /usr/share/logwatch/default.conf/logwatch.conf to /etc/logwatch/scripts/ - deleted everything except for

Format = text
--range = "Between -7 and days and -1 days"

Equally, you can leave the complete logwatch.conf file.

Tested by running (I commented out the other run-parts as I only wanted to test weekly jobs)

anacron -fn

And all works as expected.