Using the Patching Script

All this is done on the appropriate REPO server (dubrhsatserver62 or DUBORA73UPPROD) 1: Edit the hostname_list this is located in /scripts/access_check You need to create a file that contains the server names of the VMs that are scheduled to be patched on this pass (ie VMS due to be patched that day)

2: Check access to all VMs for that day Edit access_check_1.3.sh Located on /scripts/access_check/access_check_1.3.sh or Teams under Linux_documentation/Linux Bash Scripts

Modify the 2 following lines

VAR_access="PASSWORD " | sudo -S hostname ; cat /etc/crontab |grep yum_update_RHEL.sh" 
sshpass -p "PASSWORD" ssh -t -o "StrictHostKeyChecking no" USERNAME@$HOST $VAR_access | tee -a $SCR_FLOW

Replace PASSWORD with your password and USERNAME with your username

Run the script ./access_check_1.3.sh

If you see something that looks like this

#################################################
#                                               #
#    Warning, Unauthorized Access Prohibited    #
#                                               #
#################################################

[sudo] password for brindleyp: Template-OL7
Connection to 10.5.5.44 closed.

Then connection was made ok and password is correct if you don’t you will need to check that machine

3: edit RHEL_patch_script_set.sh (for RedHat) or OL_patch_script_set.sh (for Oracle) Files are located under scripts/access_check/ or in Teams under Linux Documentation/Linux Server Quarterly Patching/Patching scripts

Modify following Lines Redhat

VAR_access="hostname ; echo “PASSWORD" | sudo -S sed -i '/yum_update_RHEL.sh/c\00 23 20 jan '*' root /scripts/yum_update/yum_update_RHEL.sh' /etc/crontab ; echo "PASSWORD" | sudo -S cat /etc/crontab |grep yum_update_RHEL.sh" 

And

sshpass -p "PASSWORD” ssh -t -o "StrictHostKeyChecking no" USERNAME@$HOST $VAR_access | tee -a $SCR_FLOW

ORACLE

VAR_access="hostname ; echo "PASSWORD" | sudo -S sed -i '/yum_update_OL.sh/c\00 23 10 may '*' root /scripts/yum_update/yum_update_OL.sh' /etc/crontab ; echo "PASSWORD" | sudo -S cat /etc/crontab |grep yum_update_OL.sh 

And

sshpass -p "PASSWORD" ssh -t -o "StrictHostKeyChecking no" USERNAME@$HOST $VAR_access | tee -a $SCR_FLOW

Replace PASSWORD with your password

20 jan or 10 may with the appropriate date for crontab format is DD month

USERNAME with your username

This will modify the crontab of the servers with the date you put. Servers will be patched at 11 PM

REMEMBER to either edit or remove the files!!! They contain your Linux password!!!