For now I have crons like :
45 * * * * www-data php /var/www/console cmd:dispatch --env=prod 2>&1 > /var/log/cron/cmd_dispatch.log
And I'd like to disable email sending. In order to achieve that can I add &> /dev/null
like :
45 * * * * www-data php /var/www/console cmd:dispatch --env=prod 2>&1 > /var/log/cron/cmd_dispatch.log; &> /dev/null
Would it disable only the email sending ?
If you really want to prevent cron from sending email, you would run the service with "-m off -s" arguments.
That's presuming you want cron email completely disabled, rather than just for a given entry.
I'm not sure it will, but lets fix this properly.
The ordering of the redirection matters.
What you are trying to do, is to log both stderr and stdout messages to that file, so you should:
See also https://www.gnu.org/software/bash/manual/html_node/Redirections.html