2

describing my specific case; on our centOS 6.6 final servers , I've installed yum-cron, in order to schedule a check every night if there are updates from the active repositories.

I preferred to avoid the auto-installation, also following is the snippet of config file : /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

At the beginning I've configured also the MAILTO parameter, in order to receive the notification email externally (eg.: phil@gmail.com), but some week later I've started thinking it was not a really good practice to send out via email information about installed packages, also I modified MAILTO parameter in order to keep these info inside the server, like this:

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

The only remaining problem, is that it is not very handy to go check internal email everytime, without know if there are updates. For this reason I was thinking if it somebody knows a way to send an external notification to phil@gmail.com (eg: "user root @ server A received an internal email) without saying any other information

Thanks in advance for any suggestion

2

Check if the mailbox file for root (possibly /var/mail/root) is more recent than that of a file touched by the previous check. If so, generate a mail. Regardless, touch the last-checked file. Run this script from cron.

#!/bin/sh

FILE_TO_CHECK=/var/mail/root
LAST_RUN_FILE=/root/.mailboxcheck

if [ $FILE_TO_CHECK -nt $LAST_RUN_FILE ]; then
  echo "file is newer, hooray"
fi

touch $LAST_RUN_FILE

Another option would be to collect the mail spools somewhere (e.g. via rsync) and then have a webpage or some other sort of dashboard showing that collected information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.