How to silence cron?

xtouqh at mm.st xtouqh at mm.st
Fri Sep 11 13:31:15 UTC 2020


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.
> 
> Abbriviated crontab looks like
> 
> SHELL=/bin/sh
> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
> MAILTO="someimportantperson"
> 
> */5 * * * * su -m www -c "/usr/local/bin/php 
> /usr/local/www/pathtoscript.php"
> 
> Roots shell is FBSD standard csh
> www's shell is /usr/sbin/nologin
> 
> With the rest of the crons I do want mail to be sent, just not this one.

crontab(5) describes -n, which will silence only the successful runs, i.e:

*/5 * * * * -n su -m www -c "...."

If that works for you, good.  If not, how *exactly* you used the 
redirections?


More information about the freebsd-questions mailing list