Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Aug 2006 10:54:40 -0700
From:      David King <dking@ketralnis.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: e-mail from cron
Message-ID:  <CD33DDB2-4602-4F10-8240-1D32FFE17E7E@ketralnis.com>
In-Reply-To: <20060823162301.9cf362fa.albi@scii.nl>
References:  <012e01c6c6bd$29966ac0$d51a2cd0@lisac> <20060823162301.9cf362fa.albi@scii.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 30      5       1       *       *       root    periodic monthly 2>&1
>> | sendmail service@jellico.com
>> but all I get is a blank email sent to service@jellico.com
> [...]
> also.. using 2>&1 doesn't seem appropriate, afaik you would use  
> that in
> crontab if you don't want to get emails via cron

You would use "2>&1" in conjunction with ">/dev/null" if you didn't  
want to get emails from cron, sure. But if you don't redirect stderr,  
then stderr doesn't end up in the mail.

That is, if "periodic monthly" outputs stdout and stderr, and you  
only redirect (with "|") stdout, then you don't get the stderr.  
"2>&1" says, "send output from file-descriptor 2 (stderr) to file- 
descriptor 1 (stdout)". That way the redirection with the pipe  
contains both stdout and stderr.

As far as redirecting the periodic output to a different user, set  
"daily_output" in /etc/periodic.conf. See /etc/defaults/periodic.conf  
for an example. You'd of course have to do the same for weekly and  
monthly.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CD33DDB2-4602-4F10-8240-1D32FFE17E7E>