Friday, 13 November 2015

YUM Update for a PUM Update/Upgrade Image

Installation of Repositories
-------------------------------------
Once your vm is able to access the internet, install the public yum repository as follows:
1.    Login to your vm as the root user
2.    Issue the command:

[root@servername]# cd /etc/yum.repos.d
[root@servername]# wget http://public-yum.oracle.com/public-yum-el5.repo



Optional - Limiting Updates to Security Only

To install the security plugin, issue the following command:

[root@servername]# yum install yum-security

After the plugin is installed, to only perform security-related updates issue the command:

[root@servername]# yum --security update

For more information and options for using the yum security plugin, issue the command:

[root@servername]# man yum-security

Tuesday, 10 November 2015

Password Expiry Monitoring and Notification Script.


00 10 * * *  /bin/sh -xv /home/psoft/scripts/pwd_exp_monitor.ksh > /tmp/pwd_exp_monitor.logs &


#!/bin/bash
################################################################################
#Script: Monitor for password expire of the critical accounts psoft or oracle.
#Script Author : zafrulla.khan@xyz.com
#Date : 11/Nov/2015
#Version 2.0
################################################################################

export user_check=$(/usr/bin/whoami);
HOST_NAME=$(hostname | awk -F_ '{ print $1}')
MAILLIST="zafrulla.khan@xyz.com"
echo $user_check;
for (( i=1;i<=10;i++ ))
do
if [ "$(/usr/bin/chage -l $user_check|grep expires|grep Password|awk -F':' '{print $NF}'|sed  's/^ *//')" == "$(date --date="$i day" +"%b %d, %Y")" ]; then
echo "$user_check Password will expire in $i days, Please do change the password as early as possible"

/bin/mailx -s "$HOST_NAME - IMPORTANT $user_check password will expire in $i days - $(/bin/date +%F)" -r noreply@prologis.com $MAILLIST <<-EOF
Hello DBA/ADMIN Team,

$i Days to go.

Please consider changing the password of the user "$user_check" in host "$HOST_NAME" as early as you can.

If not changed before it expires, there will be impact on the monitoring and as well on the cron jobs execution.

==============================================================================
Password Expire Monitoring and Notification Script
==============================================================================
This script is located in the directory $(cd $(dirname $0);echo $PWD)
Host Name : $HOST_NAME
Script Name : "${0##*/}"
Version  : 2.0
===============================================================================

EOF
fi
done