Symptoms
When yum-cron is installed, this is configured by default to notify you of run-parts for Cron tasks. When this completes, it alerts you via email.
Description
You may receive an email with a similar alert, notifying you run-parts has run. You can use the information below to change the email notifications.
Subject: Cron <root@server1> run-parts /etc/cron.hourly
Body:
/etc/cron.hourly/0yum-hourly.cron:
Not using downloaded extras/repomd.xml because it is older than what we have:
Current : Mon Jul 6 18:06:49 2020
Downloaded: Wed May 20 23:19:30 2020
Not using downloaded updates/repomd.xml because it is older than what we have:
Current : Thu Jul 16 17:45:59 2020
Downloaded: Thu Jun 25 22:10:47 2020
"
Workaround
This comes from an additional package for yum. The cron job is related to this package:
yum-cron-3.4.3-167.el7.centos.noarch
And the file in question that specifically sends the hourly cronjob is this:
cat /etc/cron.hourly/yum-hourly.cron
#!/bin/bash
if [[ ! -f /var/lock/subsys/yum-cron ]]; then
exit 0
fi
# Action!
The command that actually runs is:
exec /usr/sbin/yum-cron /etc/yum/yum-cron-hourly.conf.
And the command it's getting its configuration from this file:
/etc/yum/yum-cron-hourly.conf
If we take a look at that file we also find some configuration regarding emails inside:
cat /etc/yum/yum-cron-hourly.conf
[email]
# The address to send email messages from.
# NOTE: 'localhost' will be replaced with the value of system_name.
email_from = root
# List of addresses to send messages to.
email_to = root
# Name of the host to connect to to send email messages.
email_host = localhost
There are a few ways that you can stop the emails from coming in:
Remove the package entirely since the package runs a simple yum update command every hour.
[commands]
# What kind of update to use:
# default = yum upgrade
# security = yum --security upgrade
# security-severity:Critical = yum --sec-severity=Critical upgrade
# minimal = yum --bugfix update-minimal
# minimal-security = yum --security update-minimal
# minimal-security-severity:Critical = --sec-severity=Critical update-minimal
update_cmd = default
You can stop the service from running by using one of these commands : /bin/rm -f /var/lock/subsys/yum-cron
systemctl stop yum-cron
Or, If you want the service to keep running and the command to be issued, you can alternatively comment out the email section from the configuration file mentioned above :
/etc/yum/yum-cron-hourly.conf
Once the configuration has been modified, please restart the service, so the daemon is aware of the changes.