Avoid automatic Cron Job emails

For every Cron Job that I set up in my YunoHost server, I get an email.

I would like instead to disable automatic emails and configure email sending only when the cron job fails.

How can I do so?

Thanks a lot!
T

Basically an email is sent if the “output” of the command being ran is not empty

A basic trick usually consists in redirecting stdout to /dev/null, and therefore only if stderr (the error output) is not empty will a mail be sent :

yourcommand >/dev/null

However this may depend on specific details such as : maybe your specific program always display stderr messages (e.g. maybe warnings) or on the contrary it never display any error (so it will never send an email) so it’d need more subtle engineering

2 Likes

Thanks a lot @Aleks! I will meddle with these suggestions and I will post here if I need more help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.