Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2020 22:46:19 +0100
From:      RW <rwmaillists@googlemail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to silence cron?
Message-ID:  <20200911224619.4a134d23@gumby.homeunix.com>
In-Reply-To: <b0f49812-4d0a-e301-3ef2-816431ae3dbe@nethead.se>
References:  <b0f49812-4d0a-e301-3ef2-816431ae3dbe@nethead.se>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200911224619.4a134d23>