Yum email updates notification · uwot.eu
another meaningless subtitle

Yum email updates notification

· by fabio · Read in about 3 min · (478 Words)

Yum provides a very useful package called “yum-cron”, its most publicized feature is the ability to enable yum to run nightly cron scheduled packages upgrades.
I honestly don’t really think it is a good idea at all to let the system manage updates by himself but yum-cron can be used for another bunch of tasks, the most interesting one being: send an email if there are updates available.

yum install yum-cron

Configuration is actually pretty simple.

cat /etc/sysconfig/yum-cron 
---
# Pass any given paramter to yum, as run in all the scripts invoked
# by this package.  Be aware that this is global, and yum is invoked in 
# several modes by these scripts for which your own parameter might not
# be appropriate
YUM_PARAMETER=

# Don't install, just check (valid: yes|no)
CHECK_ONLY=yes

# Check to see if you can reach the repos before updating (valid: yes|no)
CHECK_FIRST=no

# Don't install, just check and download (valid: yes|no)
# Implies CHECK_ONLY=yes (gotta check first to see what to download)
DOWNLOAD_ONLY=no

# Error level, practical range 0-10, 0 means print only critical errors which
# you must be told, 1 means print all errors, even ones that are not important
# Level 0 is the default
# ERROR_LEVEL=0

# Debug level, practical range 0-10, higher number means more output
# Level 1 is a useful level if you want to see what's been done and
# don't want to read /var/log/yum.log
# Level 0 is the default
# DEBUG_LEVEL=1

# randomwait is used by yum to wait random time
# default is 60 so yum waits random time from 1 to 60 minutes
# the value must not be zero
RANDOMWAIT="60"

# if MAILTO is set and the mail command is available, the mail command 
# is used to deliver yum output

# by default MAILTO is unset, so crond mails the output by itself
# example:  MAILTO=root
MAILTO=root

# you may set SYSTEMNAME if you want your yum emails tagged differently
# default is output of hostname command 
# this variable is used only if MAILTO is set too
SYSTEMNAME="uwot.eu" 

# you may set DAYS_OF_WEEK to the days of the week you want to run 
# default is every day 
DAYS_OF_WEEK="0123456" 

# which day should it do cleanup on?  defaults to 0 (Sunday).  If this day isn't in the 
# DAYS_OF_WEEK above, it'll never happen
CLEANDAY="0123456"

# set to yes to make the yum-cron service to wait for transactions to complete
SERVICE_WAITS=yes

# set maximum time period (in seconds) for the yum-cron service to wait for
# transactions to complete.  The default is 300 seconds (5 minutes)
SERVICE_WAIT_TIME=300

“CHECK_ONLY” parameter is what makes yum-cron just check for updates and report back via email without installing anything.
Everything else is pretty much straightforward, for more information “man yum-cron”.
yum-cron is managed like every other service with “service” and “chkconfig” commands.