Skip to main content

Reboot Pre-Checks Script UNIX

#!/usr/bin/sh
LINUX_CMDS ()
{
EMAIL=bibhuti2sol@gmail.com
TODAY=`date +%d%b%Y`
ECHO_CMD=”/bin/echo -e”
}
CHECK_UID ()
{
USERID=`id -u`
if [ $USERID -eq 0 ]
then
continue;
else
$ECHO_CMD “\n\t Please Run this script as root !! \n\n”
exit;
fi
}
OS_DETAILS ()
{
$ECHO_CMD “\n\t UNAME Output” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
uname -a >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\t OS Release” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
cat /etc/*release >> $CHECK_LIST 2>&1
}
NFS_DETAILS ()
{
$ECHO_CMD “\n\n\tGiven below is NFS mounts” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/usr/sbin/showmount -a >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\n\tGiven below is NFS exports” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/usr/sbin/showmount -e >> $CHECK_LIST 2>&1
}
CHECK_REDHAT_CLUSTER()
{
$ECHO_CMD “\n\n\tGiven below is Redhat Cluster details” >> $CHECK_LIST
$ECHO_CMD ” =========================================\n” >> $CHECK_LIST
/usr/sbin/clustat > /dev/null 2>&1
if [ $? -gt 0 ]
then
$ECHO_CMD “No Redhat cluster found on this server” >> $CHECK_LIST
else
/usr/sbin/clustat >> $CHECK_LIST
fi
}
CHECK_MULTIPATH()
{
$ECHO_CMD “\n\n\tGiven below is DISK MULTIPATH STATUS” >> $CHECK_LIST
/sbin/vxdisk list > /dev/null 2>&1
if [ $? -gt 0 ]
then
$ECHO_CMD “\n\t Multipathd service status” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/sbin/service multipathd status >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\t Multipath Checker Output is given below” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/usr/bin/perl /sysadm/bin/path_checker_linux.pl >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\t Multipath -ll output is given below” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/sbin/multipath -ll >> $CHECK_LIST 2>&1
else
$ECHO_CMD “\n\t Veritas Disk Multipath Checker Output is given below” >> $CHECK_LIST
$ECHO_CMD ” =========================================\n” >> $CHECK_LIST
/usr/bin/perl /sysadm/bin/path_checker_veritas.sh >> $CHECK_LIST 2>&1
fi
}
CHECK_VERITAS()
{
$ECHO_CMD “\n\n\tGiven below is Veritas Cluster details” >> $CHECK_LIST
$ECHO_CMD ” =========================================\n” >> $CHECK_LIST
/sbin/vxdisk list > /dev/null 2>&1
if [ $? -gt 0 ]
then
$ECHO_CMD “No Veritas found on this server” >> $CHECK_LIST
else
$ECHO_CMD “\n\n\tGiven below is Veritas Cluster Status” >> $CHECK_LIST
/opt/VRTSvcs/bin/hastatus -summ >> $CHECK_LIST
$ECHO_CMD “\n\n\tGiven below is Veritas Disk List ” >> $CHECK_LIST
/sbin/vxdisk list >> $CHECK_LIST
$ECHO_CMD “\n\n\tGiven below is Veritas All Disks List ” >> $CHECK_LIST
/sbin/vxdisk -o alldgs list >> $CHECK_LIST
$ECHO_CMD “\n\n\tGiven below is Veritas DG Output” >> $CHECK_LIST
/sbin/vxdg list >> $CHECK_LIST
$ECHO_CMD “\n\n\tGiven below is VXPRINT Output” >> $CHECK_LIST
/sbin/vxprint -ht >> $CHECK_LIST
fi
}
CHECK_DF ()
{
$ECHO_CMD “\n\tGiven below is DF out put” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
df -h >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\tGiven below is /etc/fstab” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
cat /etc/fstab >> $CHECK_LIST 2>&1
}
CHECK_var_tmp_pre ()
{
$ECHO_CMD “\n\t/var/tmp filesystem utilisation before the activity” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
df -h /var/tmp >> $CHECK_LIST 2>&1
}
CHECK_var_tmp_post ()
{
$ECHO_CMD “\n\t/var/tmp filesystem utilisation after the activity” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
df -h /var/tmp >> $CHECK_LIST 2>&1
}
CHECK_NETWORK_LINUX ()
{
$ECHO_CMD “\n\n Given below is Network Configuration” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/sbin/ifconfig | egrep -C 1 “eth|bond*” | grep -v “RX” >> $CHECK_LIST 2>&1
$ECHO_CMD “\n Given below is Route Configuration” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
/bin/netstat -rn >> $CHECK_LIST 2>&1
$ECHO_CMD “\n Given below is speed settings for each lan cards” >> $CHECK_LIST
$ECHO_CMD ” ========================================================\n” >> $CHECK_LIST
X=0
for i in `/sbin/ifconfig | grep encap | awk ‘{print $1}’| grep -v bond | grep -v “:[1-9]”| grep -v lo`
do
LAN_DTLS[$X]=$i
X=`expr $X + 1`
done
X=0
TOT_ELM_LAN_DTLS=${#LAN_DTLS[*]}
while [ $TOT_ELM_LAN_DTLS != $X ]
do
$ECHO_CMD “\nSpeed settings of LAN ${LAN_DTLS[$X]} :” >> $CHECK_LIST
$ECHO_CMD “===================================================” >> $CHECK_LIST
/sbin/ethtool ${LAN_DTLS[$X]} >> $CHECK_LIST 2>&1
X=`expr $X + 1`
done
}
CHECK_PATCHES_LX ()
{
$ECHO_CMD “\n\n\t Installed RPM’s and versions” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
rpm -qa >> $CHECK_LIST 2>&1
}
HARDWARE_LX ()
{
$ECHO_CMD “\n\n\t Hardware details” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
/sbin/lspci -v >> $CHECK_LIST 2>&1
ls -l /sys/block/*/device >> $CHECK_LIST 2>&1
cat /proc/scsi/scsi >> $CHECK_LIST 2>&1
#$ECHO_CMD “\n\n\t DMIDECODE Output” >> $CHECK_LIST
#$ECHO_CMD ” =================================================” >> $CHECK_LIST
#/usr/sbin/dmidecode >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\n\t CPU Details given below” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
cat /proc/cpuinfo | egrep “processor” >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\t Physical & Swap Memory Details given below” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
cat /proc/meminfo |egrep “MemTotal|SwapTotal” >> $CHECK_LIST 2>&1
}
LVM_DETAILS ()
{
$ECHO_CMD “\n\n\t LVM Details given below” >> $CHECK_LIST
$ECHO_CMD ” =================================================” >> $CHECK_LIST
$ECHO_CMD “\n PV Details” >> $CHECK_LIST
$ECHO_CMD ” ===============” >> $CHECK_LIST
pvs >> $CHECK_LIST 2>&1
$ECHO_CMD “\n VG Details” >> $CHECK_LIST
$ECHO_CMD ” ===============” >> $CHECK_LIST
vgs >> $CHECK_LIST 2>&1
$ECHO_CMD “\n LV Details” >> $CHECK_LIST
$ECHO_CMD ” ===============” >> $CHECK_LIST
lvs -a -v -o +devices >> $CHECK_LIST 2>&1
$ECHO_CMD “\n\n\tVGDISPLAY OUTPUT” >> $CHECK_LIST
$ECHO_CMD ” ==========================================\n” >> $CHECK_LIST
vgdisplay -v >> $CHECK_LIST 2>&1
}
GEN_PRE_LINUX_REBOOT_CHECK_LIST ()
{
CHECK_LIST=Pre-reboot-checklist-`uname -n`-$TODAY.txt
$ECHO_CMD “\n\n\t\t Pre Reboot checklist generated on `uname -n` on $TODAY ” > $CHECK_LIST
$ECHO_CMD “\t\t***********************************************************” >> $CHECK_LIST
$ECHO_CMD “\t\t***********************************************************” >> $CHECK_LIST
OS_DETAILS
CHECK_REDHAT_CLUSTER
CHECK_VERITAS
CHECK_DF
LVM_DETAILS
CHECK_MULTIPATH
HARDWARE_LX
CHECK_NETWORK_LINUX
NFS_DETAILS
CHECK_PATCHES_LX
CHECK_var_tmp_pre
#/usr/bin/mailx -s “Pre Reboot checklist generated on `uname -n` on $TODAY” $EMAIL $CHECK_LIST
$ECHO_CMD “\t\t***********************************************************” >> $CHECK_LIST
$ECHO_CMD “\t\t***********************************************************” >> $CHECK_LIST
OS_DETAILS
CHECK_REDHAT_CLUSTER
CHECK_VERITAS
CHECK_DF
LVM_DETAILS
CHECK_MULTIPATH
HARDWARE_LX
CHECK_NETWORK_LINUX
NFS_DETAILS
CHECK_PATCHES_LX
CHECK_var_tmp_post
#/usr/bin/mailx -s “Pre Reboot checklist generated on `uname -n` on $TODAY” $EMAIL > $CHECK_LIST
#fi
echo ” ” >> $CHECK_LIST
fi
}
===========================================================
By: Bibhuti Bhusan

Comments

Popular posts from this blog

HP SMART ARRAY CLI COMMANDS

Show configuration : /opt/hp/hpssacli/bin/hpssacli ctrl all show config Controller status /opt/hp/hpssacli/bin/hpssacli ctrl all show status Show detailed controller information for all controllers /opt/hp/hpssacli/bin/hpssacli ctrl all show detail Show detailed controller information for controller in slot 0 /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 show detail Rescan for New Devices /opt/hp/hpssacli/bin/hpssacli rescan Physical disk status /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 pd all show status Show detailed physical disk information /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 pd all show detail Logical disk status /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 ld all show status View Detailed Logical Drive Status /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 ld 2 show Create New RAID 0 Logical Drive /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 create type=ld drives=1I:1:2 raid=0 Create New RAID 1 Logical Drive /opt/hp/hpssacli/bin/hpssacli ctrl slot=0 create type=ld dri...

Monthly Mksys OS backup AIX

Step-1 Estimate Backup: ================================================================= df -tk `lsvgfs rootvg` | awk ‘{total+=$3}\ END {printf “Estimated mksysb size: %d bytes, %.2f GB\n”, total*1024, total/1024/1024}’ It will give you the estimated time of backup, Step-2 Backup Command: backupios -file /home/padmin/28August2013_TESTVIOI_mksysb ===============> VIO Backup Command mksysb -e -i -X /mksysb/10Nov2013_server-1_mksysb============================>AIX server Backup command Step-3 ================= Pre -checks: => check NFS FS size(Backup file) and root vg FS sizes . Note : if any FS Full Zip old logs => To check performance of the server => To check root VG FS => To check /etc/exclude ========================== Step-4 ================================ server-1 mksysb -e -i -X /mksysb/02March2014_server-1_mksysb server-2 mksysb -e -i -X /mksysb/02March2014_sever-2_mksysb Post checkups: ==> check the process running o...

HP proliant SERVER hardware commands

to check the failed disk, adapter, any physical component on hp prolient server use the below important command. # hpacucli controller all show config———-to See the failed disk in HP proliant server  Smart Array P410i in Slot 0 (Embedded) (sn: 500143802590F6C0) logicaldrive 1 (558.9 GB, RAID 1, Interim Recovery Mode) array A (SAS, Unused Space: 0 MB) physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 600 GB, OK) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 600 GB, Failed)====>indicating the faild drive SEP (Vendor ID PMCSIERA, Model SRC 8x6G) 250 (WWID: 500143802590F6CF) [root@TEST:/root]# hpacucli ctrl slot=0 show Smart Array P410i in Slot 0 (Embedded) Bus Interface: PCI Slot: 0 Serial Number: 500143802590F6C0 Cache Serial Number: PBCDH0CRH1Z6R3 RAID 6 (ADG) Status: Disabled Controller Status: OK Hardware Revision: C Firmware Version: 6.60 Rebuild Priority: Medium Expand Priority: Medium Surface Scan Delay: 3 secs Surface Scan Mode: Idle Queue Depth: Autom...