how to change daily cron emails to go to user account instead of root

Руслан Бурханов r100500b at gmail.com
Thu Aug 27 13:25:42 UTC 2015


man cront

     -m mailto
             Overrides the default recipient for cron mail.  Each crontab(5)
             without MAILTO explicitly set will send mail to the mailto
mail‐
             box.  Sending mail will be disabled by default if mailto set
to a
             null string, usually specified in a shell as '' or "".

So you just can add this option on cron flags from rc.conf, like:

cron_flags="-m 'root at mymail.com'"

and restart cron daemon.

2015-08-27 16:16 GMT+03:00 Arthur Chance <freebsd at qeng-ho.org>:

> On 27/08/2015 14:11, Arthur Chance wrote:
>
>> On 27/08/2015 13:41, Ernie Luzar wrote:
>>
>>> Hello list;
>>>
>>> How do I change the daily cron emails to go to user account instead of
>>> root? I don't want any cron email going to root any more.
>>>
>>> man 5 crontab says the cron environment variable MAILTO = "account user
>>> name" is way to change the cron email from the default of "root" to the
>>> "account user name" you want.
>>>
>>> The part that is not clear is where do I place this MAILTO environment
>>> variable? Do I edit /etc/crontab and pace it next to the PATH variable
>>> or maybe in /etc/periodic.conf or /etc/csh.cshrc or /boot/loader.conf?
>>>
>>
>>
>> Only change MAILTO in the crontab if you wish *all* root's cron output
>> to go to another user.
>>
>
> Ack, misread because I was in the middle of dealing with periodic.conf.
> Ignore the following. The setting goes at the top of the crontab, on a line
> by itself.
>
>
> If you just want periodic output to go to a different place, you need to
>> change the periodic.conf variables {daily,weekly,monthly}_output and
>> {daily,weekly,monthly}_security_output. Probably the best way of doing
>> that is to add the following to /etc/periodic.conf
>>
>> # set this next line to whatever mail address you want
>> daily_output="user at dom.ain"
>> weekly_output="$daily_output"
>> monthly_output="$daily_output"
>> daily_security_output="$daily_output"
>> weekly_security_output="$daily_output"
>> monthly_security_output="$daily_output"
>>
>> If you do it that way you only have to change one mail address in the
>> future if you want to change the target address.
>>
>>
>
> --
> Those who do not learn from computing history are doomed to
> GOTO 1
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


More information about the freebsd-questions mailing list