The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to check which software is installed on UNIX sunil.1908 UNIX for Advanced & Expert Users 6 07-30-2008 12:31 PM
listing installed software ravi raj kumar UNIX for Advanced & Expert Users 2 07-10-2007 07:55 PM
Listing all Software and Tools installed hasnain UNIX for Advanced & Expert Users 7 07-03-2007 10:53 AM
Installed Software tt1ect UNIX for Dummies Questions & Answers 1 04-03-2007 04:27 AM
Installed software wakeley UNIX for Dummies Questions & Answers 3 02-08-2005 06:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-31-2008
ejk67 ejk67 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 2
Comparing installed software.

I have some 30 AIX servers and I want their software packages to be consistent. AIX provides a command to list out all pertinent information on a software package in a colon separate list - I grab this through ssh and collect in a temp directory server_name.log.

Now, I'm stuck. I can create a list of all unique packages but how do I traverse through each server list to see whether the sofware is installed?

The example below may help explain my dilema.



File 1

awk:1.1
sed:3.2
ssh:4.1.2

File 2
something:1.0.1
awk:1.1
sed:3.2

File 3

something:1.0.1
awk:1.1
bgp:1.0
sed:3.2
  #2 (permalink)  
Old 08-31-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Do you have a master list of what software should be installed?

You might want to use Perl or Awk to read the versions into an array (Perh hash) and then in the end print missing packages (array keys) and wrong versions (key values).
  #3 (permalink)  
Old 09-01-2008
ejk67 ejk67 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 2
Ugly but it works.

# I used ssh server1 lslpp -Lc > /tmp/lslpp_files/server1.log to create
# the log files. I then did a cat of all the log files sorting out the unique
# cat /tmp/lslpp_files/*log | cut -d":" -f1 | sort -u

#!/usr/bin/perl
@host=(server1, server2, server3);

for $host (@host) {
open(MYINPUTFILE, "</tmp/lslpp_files/$host.log");
my (@lines) = <MYINPUTFILE>;
foreach $line (@lines)
{
chomp;
next if /^#/;
( $PackageName, $Fileset, $Level, $State, $PTFId, $FixState, $Type, $Description, $DestinationDir, $Uninstaller, $MessageCatalog, $MessageSet, $MessageNumber, $Parent, $Automatic, $EFIXLocked, $InstallPath, $BuildDate ) = split ( /:/, $line);

#print "$host -- $Fileset -- $Level\n";
$HoH{$host}{$Fileset} = $Level;
}
close(MYINPUTFILE);
}
#
# compare file
#
open(COMPFILE, "</tmp/lslpp_files.final");
my (@complines) = <COMPFILE>;

#
# print header
#
print "fileset:server1:server2:server3\n";
foreach $compline (@complines)
{
( $Filset, $Lvl ) = split ( /:/, $compline);
print "$Filset";
for $host (@host) {
print ":$HoH{$host}{$Filset}";
}
print "\n";
}
close(COMPFILE);
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0