How to silence cron?

xtouqh at mm.st xtouqh at mm.st
Fri Sep 11 18:21:08 UTC 2020


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 at 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?


More information about the freebsd-questions mailing list