How to silence cron?

RW rwmaillists at
Fri Sep 11 21:46:27 UTC 2020

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


*/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.

More information about the freebsd-questions mailing list