From owner-freebsd-questions@freebsd.org Sat Sep 12 19:26:19 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F95C3E0F4A for ; Sat, 12 Sep 2020 19:26:19 +0000 (UTC) (envelope-from peo@nethead.se) Received: from ns1.nethead.se (ns1.nethead.se [5.150.237.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "ns1.nethead.se", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BpjKQ0YVtz4R1R for ; Sat, 12 Sep 2020 19:26:17 +0000 (UTC) (envelope-from peo@nethead.se) X-Virus-Scanned: amavisd-new at Nethead AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nethead.se; s=NETHEADSE; t=1599938764; bh=J/br4wGTIp6c6TRjp+VqASoK5LG6WjvBm8xFYA05aXU=; h=Subject:To:References:From:Date:In-Reply-To; b=F58Uinrh44JJcz8soKsNVjF04XzTJN8uQT+ci7Nbta4LGnPgrL0Amcmmumlvf98YO GEVe6rwS83C7/gUkqWfS7cucmTvi/vewhtRknB91g6w6SJ7GgGTPWSdQT2S1oowGIb je0YPsWhgkF0feQBCmFvXBVvsvuN6eEaqgRgvCM0= Subject: Re: How to silence cron? To: freebsd-questions@freebsd.org References: <20200911224619.4a134d23@gumby.homeunix.com> From: Per olof Ljungmark Message-ID: <64bf24be-b25e-0e7d-6cca-07d99f798b1a@nethead.se> Date: Sat, 12 Sep 2020 21:26:00 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200911224619.4a134d23@gumby.homeunix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BpjKQ0YVtz4R1R X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=nethead.se header.s=NETHEADSE header.b=F58Uinrh; dmarc=pass (policy=none) header.from=nethead.se; spf=pass (mx1.freebsd.org: domain of peo@nethead.se designates 5.150.237.139 as permitted sender) smtp.mailfrom=peo@nethead.se X-Spamd-Result: default: False [-2.54 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.04)[-1.044]; R_DKIM_ALLOW(-0.20)[nethead.se:s=NETHEADSE]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:5.150.237.139]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.997]; RCPT_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[nethead.se:+]; DMARC_POLICY_ALLOW(-0.50)[nethead.se,none]; NEURAL_HAM_SHORT(-0.50)[-0.497]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:8473, ipnet:5.150.192.0/18, country:SE]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2020 19:26:19 -0000 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!