I have some cron tasks, and some of them doesn't stop sending me emails.
An example task are:
*/2 * * * * php app/console mautic:email:fetch > /dev/null 2>&1
(All the tasks with the problem are mautic tasks).
I've tried some tricks for avoiding emails:
> /dev/null
>/dev/null
>/dev/null 2>&1
>/dev/null 2>&1 || true
|| true
All of them continues to send mails each run.
An example email:
/bin/sh: 1: cannot create 1: Permission denied
(I understand that's a strange error, but it's a example. I know I need to solve the error and not silence it, but I want to know why I cannot silence it with a normal method).
The question are: Why even when I redirecting the task result, or when using the || true to change the task result, cron continues sending emails? The only solution I can find (on the linked question), are to add
MAILTO=""
after the "normal" (or not-spamming) cron tasks (and before these other ones).
Related question:How do I completely silence a cronjob to /dev/null/?.
crontab
(what command do you use, or which file do you edit)? – Chris Davies Jan 27 '19 at 10:03