Last active
August 29, 2015 14:15
-
-
Save dArignac/1260ea94585ddcef27d2 to your computer and use it in GitHub Desktop.
YUM update check and mail notify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SEND_TO=$1 | |
UPDATES=`yum check-update -q | awk '{print $1}'` | |
UPDATE_COUNT=`printf "%s\n" "$UPDATES" | grep -v "^$" | wc -l` | |
UPDATE_TEXT=$(printf "%s\n" "${UPDATES}") | |
if [ "${UPDATE_COUNT}" -gt "0" ]; then | |
echo "${UPDATE_TEXT}" | mail -s "${UPDATE_COUNT} Yum-Updates are available" "${SEND_TO}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment