Comparison of 2 sun server patches using script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Comparison of 2 sun server patches using script
# 1  
Old 03-18-2009
Comparison of 2 sun server patches using script

Hi,

I am not sure what I am missing, tried to debug but was not successful, any help on this will be much appreciated.

Code:
#!/bin/sh
rm -f /tmp/t?
host1=`cat $1|grep Hostname: | awk '{print $2}'`
host2=`cat $2|grep Hostname: | awk '{print $2}'`
rel1=`cat $1|grep Release: | awk '{print $2}'`
rel2=`cat $2|grep Release: | awk '{print $2}'`
arch1=`cat $1|grep "Kernel architecture:" | awk '{print $3}'`
arch2=`cat $2|grep "Kernel architecture:" | awk '{print $3}'`

cat $1 |grep "Patch:" | awk '{print $2}'  >/tmp/t1
cat $2 |grep "Patch:" | awk '{print $2}'  >/tmp/t2

cat /tmp/t1 | awk '{print $1}'| sort  >/tmp/t3
cat /tmp/t2 | awk '{print $1}'| sort  >/tmp/t4

prev=`head -1 t3`
for  i in `cat t3`
do
        curr=$i
        if [ $prev != $curr ]
        then
                currhead=`echo $curr | cut -f 1 -d "-"`
                prevhead=`echo $prev | cut -f 1 -d "-"`
                if [ $prevhead != $currhead ]
                then
                        echo $prev >> /tmp/ta
                fi
                prev=$curr
        fi
done

rm /tmp/t?

When I execute this I get the following output, and stucks there itself.

$ ./patchscript
+ rm -f /tmp/t?
+ cat
+ grep Hostname:
+ awk {print $2}

Last edited by DukeNuke2; 03-21-2009 at 01:53 PM..
# 2  
Old 03-21-2009
Please post the content of the two input files ($1 and $2) and explain what you want to achieve.
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. AIX

List of Installed patches for AIX from given set of patches

I need to find out list of installed patches from given list of patches. I have tried using instfix -f <File containing list of patches> -i -c But I was not able to understand the output of this command. It was like below. bos.perf.tools: :0.0.0.0:?: bos.rte.libc: :0.0.0.0:?: ... (4 Replies)
Discussion started by: Saurabh Agrawal
4 Replies

2. Solaris

Sun Patches question

I have Solaris 9 on my server. From SunSolve site, I see: Solaris9 Sun Alert Patch Cluster (184.9 M) & Solaris9 (204.3 M) What is the difference between the Sun Alert Patch Cluster and the "regular" patch cluster? Thanks! (1 Reply)
Discussion started by: FredSmith
1 Replies

3. Solaris

Breaking mirror for patches, sun/os 5.9

Hi, Going to be applying patches to Sun prod (dev 1st) boxes soon, I'm going to break the mirror's on 3 file systems on the root disk prior to that (/, /var, /swap),then run 9_Recommended. Then, run it for a day or 2 before re-syncing the mirrors. But, what if I want to backout of this... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
Login or Register to Ask a Question