Skip to content

Instantly share code, notes, and snippets.

@leonirlopes
Forked from codatory/check_update.sh
Created July 18, 2022 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonirlopes/2aa7a9658948d29213ac1c55e84d5cf1 to your computer and use it in GitHub Desktop.
Save leonirlopes/2aa7a9658948d29213ac1c55e84d5cf1 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