Skip to content

Instantly share code, notes, and snippets.

@codatory
Created February 27, 2012 20:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save codatory/1926743 to your computer and use it in GitHub Desktop.
Save codatory/1926743 to your computer and use it in GitHub Desktop.
CentOS / Fedora Weekly update checking script
#!/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