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

Arthur Chance freebsd at qeng-ho.org
Thu Aug 27 13:30:10 UTC 2015


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.

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


More information about the freebsd-questions mailing list