Page 1 of 1

Cron email

Posted: Wed Oct 02, 2013 9:06 am
by ricardo777
Hello,

I have setup some crons, but how can I disable the email for it?

Getting spammed because the crons.

Re: Cron email

Posted: Wed Oct 02, 2013 11:01 am
by skid
If command return output you will get it on email. Check out if it support quite mode. If it is not, you can always suppress output by adding "> /dev/null 2>&1" to the end of command line

Code: Select all

some_commad - a arg1 -b arg2 > /dev/null 2>&1

Re: Cron email

Posted: Wed Oct 02, 2013 11:18 am
by ricardo777
skid wrote:If command return output you will get it on email. Check out if it support quite mode. If it is not, you can always suppress output by adding "> /dev/null 2>&1" to the end of command line

Code: Select all

some_commad - a arg1 -b arg2 > /dev/null 2>&1
Thank you I will try it out.

Re: Cron email

Posted: Thu Jun 14, 2018 9:08 pm
by websystems
Hello

I came here, as I had the same problem.

I tried /dev/null 2>&1 before I started to google solution. At other servers it works, at VestaCP Centos I had problem with - it did not.

I checked user crontab using shell and I found and commented this:
#MAILTO=my@emailaddress.pl
#CONTENT_TYPE="text/plain; charset=utf-8"

Now, there are no user cron emails anymore.

ANyway, if somebody knows why regular /dev/null 2>&1 does not work, please share the knowledge, as I do not like 'solutions' mentioned above.

Re: Cron email

Posted: Thu Jun 14, 2018 11:34 pm
by joem
websystems wrote:
Thu Jun 14, 2018 9:08 pm
Hello

I came here, as I had the same problem.

I tried /dev/null 2>&1 before I started to google solution. At other servers it works, at VestaCP Centos I had problem with - it did not.

I checked user crontab using shell and I found and commented this:
#MAILTO=my@emailaddress.pl
#CONTENT_TYPE="text/plain; charset=utf-8"

Now, there are no user cron emails anymore.

ANyway, if somebody knows why regular /dev/null 2>&1 does not work, please share the knowledge, as I do not like 'solutions' mentioned above.
you forgot > it should be

Code: Select all

> /dev/null 2>&1

Re: Cron email

Posted: Thu Aug 02, 2018 5:23 am
by websystems
joem wrote:
Thu Jun 14, 2018 11:34 pm
websystems wrote:
Thu Jun 14, 2018 9:08 pm
Hello

I came here, as I had the same problem.

I tried /dev/null 2>&1 before I started to google solution. At other servers it works, at VestaCP Centos I had problem with - it did not.

I checked user crontab using shell and I found and commented this:
#MAILTO=my@emailaddress.pl
#CONTENT_TYPE="text/plain; charset=utf-8"

Now, there are no user cron emails anymore.

ANyway, if somebody knows why regular /dev/null 2>&1 does not work, please share the knowledge, as I do not like 'solutions' mentioned above.
you forgot > it should be

Code: Select all

> /dev/null 2>&1

No, I did not. I just forgot it in this post. The cron entry looks like:

wget https://www.myrealdomain.com/wp-cron.ph ... processing > /dev/null 2>&1