Check subscription manager status
sudo -s # If in Docker not needed if [ "$(subscription-manager status| grep "Overall Status")" != "Overall Status: Unknown" ]; then clear echo "Properly Registered" else echo -e "Needs Registered\n\nPlease get with your server team to register this server" $SHELL fi
sudo -s # If in Docker not needed if [ "$(subscription-manager status| grep "Overall Status")" != "Overall Status: Unknown" ]; then echo "Properly Registered" else echo -e "\033[32mRed Hat Registration - Start\033[0m" if [ -z ${1+x} ]; then echo -e "\033[01m\e[4mType your username for RedHat.com, followed by [ENTER]:\e[0m\033[0m" read rhUser else #echo "rhUser is set to '$1'" declare rhUser=$1 fi if [ -z ${2+x} ]; then echo -e "\033[01m\e[4mType your password for RedHat.com, followed by [ENTER]:\e[0m\033[0m" read -s rhPass else #echo "rhPass is set to '$2'" declare rhPass=$2 fi echo -e "\033[32mSet Server Hostname - Start\033[0m" if [ -z ${3+x} ]; then echo -e "\033[01m\e[4mType your desired hostname for the server, followed by [ENTER]:\e[0m\033[0m" read hostname hostnamectl set-hostname $hostname else declare hostname=$3 hostnamectl set-hostname $hostname fi echo -e "\033[32mSet Server Hostname - Stop\033[0m" # Register Red Hat Server - Start subscription-manager register --username $rhUser --password $rhPass --auto-attach subscription-manager refresh history -c subscription-manager identity # Register Red Hat Server - Stop echo -e "\033[32mRed Hat Registration - Stop\033[0m" fi
Last Updated on February 25, 2021