Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 2020 21:26:00 +0200
From:      Per olof Ljungmark <peo@nethead.se>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to silence cron?
Message-ID:  <64bf24be-b25e-0e7d-6cca-07d99f798b1a@nethead.se>
In-Reply-To: <20200911224619.4a134d23@gumby.homeunix.com>
References:  <b0f49812-4d0a-e301-3ef2-816431ae3dbe@nethead.se> <20200911224619.4a134d23@gumby.homeunix.com>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?64bf24be-b25e-0e7d-6cca-07d99f798b1a>