Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2015 16:25:39 +0300
From:      =?UTF-8?B?0KDRg9GB0LvQsNC9INCR0YPRgNGF0LDQvdC+0LI=?= <r100500b@gmail.com>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: how to change daily cron emails to go to user account instead of root
Message-ID:  <CAGzH002f-YFRMKweeBMvcLvkx1oxnsNMHTNPRJ%2B8rSCz4kxHBg@mail.gmail.com>
In-Reply-To: <55DF0DB3.3040400@qeng-ho.org>
References:  <55DF057F.6040205@gmail.com> <55DF0C75.5000907@qeng-ho.org> <55DF0DB3.3040400@qeng-ho.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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=E2=80=90
             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=3D"-m 'root@mymail.com'"

and restart cron daemon.

2015-08-27 16:16 GMT+03:00 Arthur Chance <freebsd@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 =3D "account us=
er
>>> 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 li=
ne
> 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=3D"user@dom.ain"
>> weekly_output=3D"$daily_output"
>> monthly_output=3D"$daily_output"
>> daily_security_output=3D"$daily_output"
>> weekly_security_output=3D"$daily_output"
>> monthly_security_output=3D"$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@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGzH002f-YFRMKweeBMvcLvkx1oxnsNMHTNPRJ%2B8rSCz4kxHBg>