Operating System - Linux
1753951 Members
7795 Online
108811 Solutions
New Discussion юеВ

Re: script for check patches and kernel.any idea

 
Ming.Dynasty
Advisor

script for check patches and kernel.any idea

Hi all

since there are too many hosts while sometimes developer ask me to check if the oracle,weblogic,siebel etc patches was installed and kernel was successful sets. it always spent lots of my times. so I need now design a script to help me do this job

for example,a list of all oracle patch and a same enviroment product host kernel,so I need the script to find out which patch I have not installed or which kernel is not correct

points will given for available reply. thanks for your time

5 REPLIES 5
Peter Godron
Honored Contributor

Re: script for check patches and kernel.any idea

Hi,
at a simple level you could maintain a cntral list of all the patches that need to be installed across your machines and then perform a comparison between swlist and this list.

You can also use the security_patch_check as discussed in thread:
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=972676

and the patch assessment tool:
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=886415

Please read User Guide to Patch Management:
http://www.docs.hp.com/en/5991-4825/5991-4825.pdf
James R. Ferguson
Acclaimed Contributor

Re: script for check patches and kernel.any idea

Hi:

Peter's suggestions cover the the subject of patches very well. The idea of maintaining and deploying a common patch archive ("golden image") may be ideal for your environment.

I would urge you to (at least) use the standard patch bundles from the ITRC Patch Database. These are refreshed twice a year and are cumulative. That is, application of the latest bundles offers everything and more than its predecessor bundle. The standard bundles are the most well-tested, comprehensive sets available for the widest range of configurations:

http://www1.itrc.hp.com/service/patch/releaseIndexPage.do?BC=main|

A simple:

# swlist

...will show the release dates of these bundles in their description and provides a good marker of the overall patch state of your server.

You might also find:

# show_patches

# check_patches

...very useful tools. See their respective manpages for more information.

As for comparing kernel configurations, server-to-server, you can use:

# kmtune -l

...on 11.11, or for 11.23:

# kctune

There is no one "correct" kernel. A "correct" kernel is one that is tuned to provide a particular environment the best behavior and performance.

Regards!

...JRF...
Ming.Dynasty
Advisor

Re: script for check patches and kernel.any idea

Anyone can help me check this script I just wrote which return error when i run it.kmtune.txt is the kernel list which i need to compare with.

crmut20#sh checkkernel kmtune.txt
checkkernel[6]: Syntax error at line 25 : `done' is not expected

here is the script

--------------------------------------
list=$1
state_file=/tmp/kmtune
>$state_file
/usr/sbin/kmtune > /tmp/kmtune
typeset i=1
grep /tmp/kmtune|while read -r yy
do
if [ $i -gt 3 ]
then
unit=echo "$yy" |awk '{print $2}'
kernelid=echo "$yy" |awk '{print $1}'
unitstandard=more $list |grep $kernelid|'{print $2}'
if [ $unit -nq $unitstandard ]
then
echo "%s \n" "$kernelid" "$unit" "you may modified to" "$kernelid"
exit 0
fi

if [ $i -gt 200 ]
then
break
fi
let i=i+1

done
-----------------------------------------
Peter Godron
Honored Contributor

Re: script for check patches and kernel.any idea

Hi,
check your if-fi statements. There is a mismatch in if's and fi's, so one if statement is not 'closed' with a matching fi.
Ming.Dynasty
Advisor

Re: script for check patches and kernel.any idea

LoL sorted out

script here for anyone who has the same needed as me

-------------------------------------

list=$1
state_file=/tmp/kmtune
>$state_file
/usr/sbin/kmtune > /tmp/kmtune
typeset i=1
while read -r yy
do
if [ $i -gt 2 ]
then
unit=`echo "$yy" |awk '{print $2}'`
if [ $unit != "-" ];then
kernelid=`echo "$yy" |awk '{print $1}'`
unitstandardtemp=`more "$list" `
unitstandard=`echo "$unitstandardtemp"|grep "$kernelid [ ]"|awk '{print $2}'`
if [ $unit != $unitstandard ];then
printf "$kernelid $unit you may modified to $unitstandard \n"
fi
fi
if [ $i -gt 200 ]
then
break
fi
fi
let i=i+1

done <$state_file