NeODarK's picture

Hi, I have some machines with Turnkey Linux and I receive all days cron apt emails about updates...

How I can disable this emails but still receiving any error update email?

Thanks!!

Forum: 
Jeremy Davis's picture

Apologies on my slow response... I'm not sure how or why, but it appears that I missed your post. Apologies about that.

To be honest, I'm not 100% sure about achieving your ends. As you note, we use cron-apt. The actual cron job that get's triggered is /etc/cron.daily/apt-compat, which then in turn triggers /usr/lib/apt/apt.systemd.daily to actually check for updates and install them.

So my guess is that to only get emails for errors, you want to change the last line in /etc/cron.daily/apt-compat so that stdout (normal output) is suppressed. That should mean that no email is sent, unless there is output to stderr (error output). I'm not 100% sure it'll work so you'll need to test.

For testing, moving the jo0b (temporarily) to hourly might tighten up the feedback look a bit (creating a cron job to run every minute is probably even better, but not quite as simple to configure, so I'll leave that for you).

mv /etc/cron.daily/apt-compat /etc/cron.hourly/apt-compat

Then edit the last line from this (what it should look like by default):

exec /usr/lib/apt/apt.systemd.daily

To this:

exec /usr/lib/apt/apt.systemd.daily 1>/dev/null

Hopefully that does the trick. If not, please post back and I'll have a bit more of a dig myself.

Add new comment