Date: Fri, 11 Sep 2020 21:13:04 +0300 From: xtouqh@mm.st To: Per olof Ljungmark <peo@nethead.se>, freebsd-questions@freebsd.org Subject: Re: How to silence cron? Message-ID: <d3421471-9632-b1ab-a003-4f9ae01abb0b@mm.st> In-Reply-To: <50422f0c-0acd-5847-ed11-e5f505b10a24@nethead.se> References: <b0f49812-4d0a-e301-3ef2-816431ae3dbe@nethead.se> <41377ad1-4162-1194-7172-234c4d172e6d@mm.st> <20200911153307.690190ed@gumby.homeunix.com> <20200911143949.GE91422@bastion.zyxst.net> <50422f0c-0acd-5847-ed11-e5f505b10a24@nethead.se>
next in thread | previous in thread | raw e-mail | index | archive | help
Per olof Ljungmark wrote: > On 2020-09-11 16:39, tech-lists wrote: >> On Fri, Sep 11, 2020 at 03:32:40PM +0100, RW via freebsd-questions wrote: >>> On Fri, 11 Sep 2020 16:22:22 +0300 >>> xtouqh@mm.st wrote: >>> >>> >>>> crontab(5) describes -n, which will silence only the successful runs, >>>> i.e: >>>> >>>> */5 * * * * -n su -m www -c "...." >>> >>> >>> Where does it say that in crontab(5)? >> >> man 5 crontab[1], a couple of pages down: >> >> [...] >> >> The following command options can be supplied: >> >> -n No mail is sent after a successful run. The execution >> output >> will only be mailed if the command exits with a non-zero >> exit >> code. The -n option is an attempt to cure potentially >> copious >> volumes of mail coming from cron(8). >> >> -q Execution will not be logged. >> >> [...] >> >> [1] FreeBSD 13.0-CURRENT #0 r365391M: Tue Sep 8 23:06:14 BST 2020 > > This is 11-STABLE, it's got -n but not -q. > > Thank you all for answering. However, when I try > */5 * * * * -n su -m www -c "...." > > I get "/bin/sh: -n: not found" > More quotes? Works for me on -CURRENT, I have added '-n echo test' for user and '-n su -m www -c id' for root crontabs, and got no mail, while seeing the commands are executed in /var/log/cron, and both had output. Wonder if something is wrong with 11-STABLE backport, might be worth asking on stable@ if someone else could confirm the issue?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d3421471-9632-b1ab-a003-4f9ae01abb0b>