Re: cron and MAILTO
On Mon, Dec 19, 2011 at 05:32:44AM GMT, T o n g wrote:
> Let me explain with an example.
>
> Say I have a file under /etc/cron.d/ with the following entry:
>
> 42 4 1 * * user1 echo "This command is run 4:42 am every 1st of the month"
> 01 * 19 07 * user2 echo "This command is run hourly on the 19th of July"
>
> Usually, when the jobs do get fired up, each user receives the
> corresponding message in their email.
>
> Now, if I put 'MAILTO=user3' at the top of the file, what will happen?
It would've been quicker if you had tested it yourself or RTFM.
% man 5 crontab
In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO
if it has any reason to send mail as a result of running commands in
``this'' crontab.
If MAILTO is defined (and non-empty), mail is sent to the user so
named. MAILTO may also be used to direct mail to multiple recipients
by separating recipient users with a comma. If MAILTO is defined but
empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to
the owner of the crontab.
Regards,
--
Raf
Reply to: