Domanda

I am running a cron job which delivers a mail with a custom subject. The crontab entry is similar to :

python script.py 2>&1 | mail -s "Custom Subject" user@gmail.com

The mail from the mail -s is delivered to the user@gmail.com inbox just fine. But user@gmail.com receives an extra mail from the cron-daemon with the subject as python script.py 2>&1 | mail -s "Custom Subject" user@gmail.com and the email body being a warning about an empty mail being delivered. I am not sure where this extra email is originating from and would really like to know how to stop it.

Maybe related to: Extra email from Cron Daemon when running an email list script

È stato utile?

Soluzione

Maybe you are probably getting the (empty) output of the mail command.

Try

python script.py 2>&1 | mail -s "Custom Subject" user@gmail.com  >/dev/null 2>&1

Alternatively, set

MAILTO=""

at the beginning of your crontab.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top