-
-
Save leonirlopes/2aa7a9658948d29213ac1c55e84d5cf1 to your computer and use it in GitHub Desktop.
CentOS / Fedora Weekly update checking script
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 | |
UPDATES=`yum check-update -q | awk '{print $1}'` | |
COUNT=`printf "%s\n" "$UPDATES" | grep -v "^$" | wc -l` | |
YUM=`printf "%s\n" "$UPDATES" | grep -v "^$" | grep yum` | |
echo '--------------------------------------------------------------------------------' | |
echo " Weekly Update Notification for `hostname`" | |
echo " -> $COUNT update(s) available" | |
if [ -n "$YUM" ]; then | |
echo ' -> IMPORTANT: A Yum update is available. Perform this separately and first.' | |
fi | |
echo '--------------------------------------------------------------------------------' | |
printf "%s\n" "$UPDATES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment