How to silence cron?

Per olof Ljungmark peo at nethead.se
Sat Sep 12 19:26:19 UTC 2020


On 2020-09-11 23:46, RW via freebsd-questions wrote:
> On Fri, 11 Sep 2020 15:11:49 +0200
> Per olof Ljungmark wrote:
> 
>> Hi,
>>
>> What would be the proper way to silence output from a php script
>> running under cron? I have tried variations of /dev/null and 2>&1 but
>> getting nowhere.
>>
> 
> Have you tried
> 
> SHELL=/bin/sh
> 
> */5 * * * * su -m www -c "/usr/local/bin/php /usr/local/www/pathtoscript.php" >/dev/null 2>&1
> 
> the redirection has to take place under a bourne-compatible shell,
> so outside of the quotes.
> 
>    
> 
> 
> 
> On Fri, 11 Sep 2020 19:44:17 +0100
> tech-lists wrote:
> 
> 
>> I *think* you can set MAILTO: to /dev/null but I'm not 100% sure. But
>> if you can, I think it'll do what you want, if that is to have no
>> mail at all for www user.
> 
> Crontab variable assignments apply to the lines below the assignment.
> It should be possible to divide the crontab into sections with different
> MAILTO values.

Yes, exactly, this is where I am aiming at now.

Thanks all for replying!


More information about the freebsd-questions mailing list