# periodic sendmail question



## PhilPotter (Jun 10, 2018)

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_ (Jun 11, 2018)

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)


```
# 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 (Jun 11, 2018)

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:

```
# Disable Sendmail
sendmail_cert_create="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
```

In /etc/periodic.conf:

```
# 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:

```
# 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 (Jun 11, 2018)

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 (Jun 11, 2018)

Datapanic said:


> 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.



Datapanic said:


> In periodic.conf, look for the following lines:
> 
> daily_output="root"                                  # user or /file
> weekly_output="root"                                  # 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 (Jun 11, 2018)

ShelLuser said:


> 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:
> ...



Well, maybe you should correct it where I found the source.  Quite claiming I am giving bad advise - that's twice.


----------



## ShelLuser (Jun 11, 2018)

Datapanic said:


> 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.


----------



## PhilPotter (Jun 11, 2018)

ShelLuser said:


> 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.


----------



## mariusvw (Sep 8, 2020)

Datapanic said:


> Well, maybe you should correct it where I found the source.  Quite claiming I am giving bad advise - that's twice.


Datapanic first of all, thanks for your reply. To me the values were quite useful knowledge. Didn't know you could set logfiles.

I always find it difficult when things come over rude in text, I'm sure ShelLuser didn't ment to be rude.

What went "wrong" here is only the copy action of the defaults.
This  copies all values instead of only overriding the 3 values you wanted to change.

In case you seriously want to lock all values to the state you copy, this might be what you want.
Some cases I do the same to prevent default changes when upgrading.
This comes with a certain risk when the FreeBSD team does change the default value that your config won't be updated.
It is not wrong persé but you have to really think about if this is what you want.
When copying all changes you have to verify that file every update for changes that you might need to merge.

And as ShelLuser stated, always verify with the manual, might save you a lot of time now and in the future.


----------



## drhowarddrfine (Sep 8, 2020)

mariusvw Just to be sure you know, you replied to a two-year old thread.


----------



## mariusvw (Sep 17, 2020)

drhowarddrfine said:


> mariusvw Just to be sure you know, you replied to a two-year old thread.


Yep


----------



## drhowarddrfine (Sep 18, 2020)

mariusvw You must have a reeeeaaalllly slow internet connection.


----------



## l2f (Oct 30, 2020)

ShelLuser said:


> 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.





Datapanic said:


> Well, maybe you should correct it where I found the source.  Quite claiming I am giving bad advise - that's twice.





ShelLuser said:


> 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:
> ...


Oops you forget the redirection to /etc/periodic.conf.local for your grep command 
`# grep -e '^[a-z]*_output=' /etc/default/periodic.conf > /etc/periodic.conf.local`


----------



## Datapanic (Oct 30, 2020)

Also, it's default*s* /etc/defaults/periodic.conf


----------

