You are not logged in.

#1 2020-06-16 21:21:53

Ooops
Member
Registered: 2020-06-16
Posts: 5

[Solved] How do i (correctly) disable anacron's mailing?

Hi...

I added a job for a daily btrfs scrub to /etc/anacrontab

# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=30
# the jobs will be started during the following hours only
#START_HOURS_RANGE=0-24

#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

1                                0                                daily-scrub                btrfs scrub start /

...and i assumed that removing the "MAILTO=" line is enough to stop anacron mails (at least all documentation i found implied you have to configure mailing AND add MAILTO=<address> to enable mailing).

But instead i now get a daily error:

journalctl output:
anacron[2255]: Tried to mail output of job `daily-scrub', but mailer process (/usr/sbin/sendmail) exited with status 65

Of course I could just ignore the error, redirect the output, remove msmtp (which successfully stops anacron from trying to send a mail) or configure anacron mailing to then ignore the email...


But why is anacron even trying to send a mail and isn't there a "clean" way to disable it?

Last edited by Ooops (2020-06-17 22:46:09)

Offline

#2 2020-06-16 21:31:21

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [Solved] How do i (correctly) disable anacron's mailing?

The documentation leads me to believe otherwise.

man 8 anacron wrote:

If a job generates any output on its standard output or standard error, the output is mailed to the user running Anacron (usually root), or to the address contained by the MAILTO environment variable in the crontab, if such exists. If the LOGNAME environment variable is set, it will be used as From: field.

Offline

#3 2020-06-17 22:45:00

Ooops
Member
Registered: 2020-06-16
Posts: 5

Re: [Solved] How do i (correctly) disable anacron's mailing?

Thanks... Not the answer i hoped for but the "[...]mailed to the user running Anacron (usually root), or to the address contained by the MAILTO environment variable in the crontab, if such exists" part got me thinking.

Looks like not adding a MAILTO variable was the completely wrong idea...

MAILTO="" on the other hand seems to have solved my problem and stopped anacron from trying (and failing...) to send mails.

Last edited by Ooops (2020-06-17 22:45:19)

Offline

Board footer

Powered by FluxBB