periodic sendmail question

PhilPotter

Member

Reaction score: 8
Messages: 22

I’m really sorry if this is documented somewhere in the handbook or elsewhere, but in my ignorance I can’t seem to find it. I’ve just installed a FreeBSD 11.1-RELEASE VM, and specifically opted not to enable sendmail.

In my /var/log/maillog file, I get sendmail related errors at around 3am every morning, and it seems that the periodic daily cron job is trying to use sendmail (and failing) to deliver a message to root@localhost. What is the recommended way to disable periodic from trying to do this without switching off the related daily cron job entirely? To be clear, I'm not interested in receiving mail about system activity to a local mailbox, I would rather just review log files etc.

I’ve had a play with /etc/defaults/periodic.conf and the files in /etc/periodic/daily, but they don't seem to help - I am probably just not doing it right and would rather not tear this VM apart looking for the right answer :) Thank you for any advice in advance.

Regards,
Phil
 

m0nkey_

Member

Reaction score: 7
Messages: 20

I use postfix, so one of the things to do is turn off the sendmail specific tasks in /etc/periodic.conf. It's likely this is what you're looking for? (don't touch /etc/defaults/periodic.conf)

Code:
# Disabled sendmail specific tasks
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
 

ShelLuser

Son of Beastie

Reaction score: 1,727
Messages: 3,546

The default files (/etc/defaults/rc.conf and /etc/defaults/periodic.conf) are your friends here. Just view them and look up anything related to sendmail and you should have enough to disable it.

Keep in mind that just disabling periodic isn't enough, there are also some sendmail services which get automatically started.

On my main server I use Postfix and there I use the following...

In /etc/rc.conf:
Code:
# Disable Sendmail
sendmail_cert_create="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
In /etc/periodic.conf:
Code:
# Postfix setup (disable sendmail)
daily_clean_hoststat_enable="NO"
daily_status_include_submit_mailq="NO"
daily_status_mail_rejects_enable="NO"
daily_queuerun_enable="NO"
daily_submit_queuerun="NO"
And finally in /etc/mail/mailer.conf:
Code:
# Postfix setup for sendmail
sendmail        /usr/local/sbin/sendmail
send-mail       /usr/local/sbin/sendmail
mailq           /usr/local/sbin/sendmail
newaliases      /usr/local/sbin/sendmail
After all that you should be good.
 

Datapanic

Well-Known Member

Reaction score: 178
Messages: 371

Here's what I do:

cp /etc/defaults/periodic.conf /etc
chmod 644 /etc/periodic.conf
vi /etc/periodic.conf

In periodic.conf, look for the following lines:

daily_output="root" # user or /file
weekly_output="root" # user or /file
monthly_output="root" # user or /file

and change them to a file:

daily_output="/var/log/daily.log" # user or /file
weekly_output="/var/log/weekly.log" # user or /file
monthly_output="/var/log/monthly.log" # user or /file

This wont solve your sendmail.cf issues, but will set your system to log these reports to a file instead of trying to email them to you.
 

ShelLuser

Son of Beastie

Reaction score: 1,727
Messages: 3,546

Here's what I do:

cp /etc/defaults/periodic.conf /etc
chmod 644 /etc/periodic.conf
vi /etc/periodic.conf
That's seriously bad advice. The files in /etc/default aren't there just for show, they're already being used by the system. So just copying it serves no purpose at all, it will only over complicate things, possibly even disrupt things.

In periodic.conf, look for the following lines:

daily_output="root" # user or /file
weekly_output="root" # user or /file
monthly_output="root" # user or /file

and change them to a file:

daily_output="/var/log/daily.log" # user or /file
weekly_output="/var/log/weekly.log" # user or /file
monthly_output="/var/log/monthly.log" # user or /file
If you want to change this then the correct way to do so would be:

# grep -e '^[a-z]*_output=' /etc/default/periodic.conf /etc/periodic.conf.local, followed by editing /etc/periodic.conf.local to make the required changes. See also periodic.conf(5).

(edit)

In other words: only copy the values which you want to change, then apply the changes to the other file.
 

Datapanic

Well-Known Member

Reaction score: 178
Messages: 371

That's seriously bad advice. The files in /etc/default aren't there just for show, they're already being used by the system. So just copying it serves no purpose at all, it will only over complicate things, possibly even disrupt things.


If you want to change this then the correct way to do so would be:

# grep -e '^[a-z]*_output=' /etc/default/periodic.conf /etc/periodic.conf.local, followed by editing /etc/periodic.conf.local to make the required changes. See also periodic.conf(5).

(edit)

In other words: only copy the values which you want to change, then apply the changes to the other file.
Well, maybe you should correct it where I found the source. Quite claiming I am giving bad advise - that's twice.
 

ShelLuser

Son of Beastie

Reaction score: 1,727
Messages: 3,546

Well, maybe you should correct it where I found the source. Quite claiming I am giving bad advise - that's twice.
If you don't want me to warn you about giving bad advice then don't give bad advice, it's as simple as that. I'm definitely not going to stop doing so.

Just for the record: this is nothing personal, I don't care who it is, but when I notice someone sharing bad advice then I will speak up about it. Simply because this isn't about you or me, it's about other readers who may pick up on such advice and as a result could find themselves into a heap of problems.

As to your anonymous source of information... if you stick with official sources such as periodic.conf(5) (so: man periodic.conf) then situations as these are much less likely to happen.
 
OP
OP
P

PhilPotter

Member

Reaction score: 8
Messages: 22

In /etc/periodic.conf:
That's really helpful, thanks - I will give that a try. I should have thought of the man page for periodic.conf, it didn't occur to me as the file doesn't exist on my system, yet that would make sense if it is only there to override defaults with new values.
 
Top