Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Red Hat – Check Subscription / Register Server

Posted on February 21, 2017February 25, 2021 By David Kittell

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
Originally Posted on February 21, 2017
Last Updated on February 25, 2021
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

CentOS Code Fedora Red Hat UNIX UNIX Shell Scripts Red HatRedHatregisterregistrationRHEL

Post navigation

Previous post
Next post

Related Posts

PHP CLI – Create WordPress Username

Posted on October 29, 2015February 26, 2016

Currently this code only creates a subscriber user in WordPress. Due to security concerns I likely won’t work on this to make it do greater permissions. php wp-create-user.php MyBasicUser User@example.com # php wp-create-user.php MyBasicUser User@example.com Username not in use, creating user. User Created Username: MyBasicUser Password: 5y1kZSkMO0bP # # php…

Read More

Read Text File Content With Try Catch

Posted on September 18, 2013October 26, 2015

Imports System.IO public class Test public Shared Sub Main Dim srReader As IO.StreamReader Dim strLine As String Dim blnDone As Boolean = False Dim strFileName As String = "test.txt" ‘Read text from a file and display it in a list box. srReader = New IO.StreamReader(strFileName) Try While Not blnDone strLine…

Read More

MSSQL – Valid Date

Posted on March 14, 2014October 26, 2015

Validate a non-DateTime data type field is a really a date. SET LANGUAGE English; — Not necessary but can be helpful SELECT ISDATE(’15/04/2008′); –Returns 0. SELECT ISDATE(’04/15/2008′); –Returns 1. Originally Posted on March 14, 2014Last Updated on October 26, 2015 All information on this site is shared with the intention…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes