Skip to content

Instantly share code, notes, and snippets.

@thimslugga
Forked from karnauskas/yum_update_report.sh
Created October 20, 2025 14:04
Show Gist options
  • Save thimslugga/a65d986da4fe1a7e6c0ca12a28e80665 to your computer and use it in GitHub Desktop.
Save thimslugga/a65d986da4fe1a7e6c0ca12a28e80665 to your computer and use it in GitHub Desktop.
Yum update checker with severities RHEL/CentOS/Fedora
#!/bin/bash
#####
## Author: [email protected]
## Dept: Consulting/Infrastructure
## Detail: Script to check updates and their severity
## Example: yum_update_report.sh -s Moderate
#####
function validations ()
{
SEVERITY=$1
case "${SEVERITY}" in
All|all) COMMAND="yum updateinfo list"
;;
Critical|critical) COMMAND="yum updateinfo list --security --sec-severity=Critical"
;;
Important|important) COMMAND="yum updateinfo list --security --sec-severity=Important"
;;
Moderate|moderate) COMMAND="yum updateinfo list --security --sec-severity=Moderate"
;;
Bugfix|bugfix) COMMAND="yum updateinfo list --bugfix"
;;
Enhancement|enhancement) COMMAND="yum updateinfo list | grep enhancement"
;;
esac
}
function check_updates ()
{
$COMMAND
}
function export ()
{
$COMMAND | awk '{print $3}' | grep `uname -m` > /tmp/yum_pending_updates.log
}
function usage ()
{
cat <<EOF
usage: $0 options
OPTIONS:
-s Severity: All, Critical, Important, Moderate, Bugfix, Enhancement
-h Show Help
EOF
}
## Main
while getopts "s:n:ha" OPTION
do
case $OPTION in
h)
usage
exit
;;
s)
SEVERITY=$OPTARG
;;
?)
usage
exit
;;
esac
done
if [[ -z $SEVERITY ]]
then
usage
exit 1
else
validations $SEVERITY
check_updates
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment