Operating System - HP-UX
1833589 Members
4237 Online
110061 Solutions
New Discussion

Installed patch verification script -- Have fun!

 
Craig A. Sharp
Super Advisor

Installed patch verification script -- Have fun!

Hi all,

Here is a simple script in perl to check for install patches.

Put your list of patches in patch.list eg: PHSS_XXXXX
PHCO_XXXXX

Be sure to modify the location of the .list files in the script.

Run the script and it will generate a file result.list that will tell you if the patches are installed or not.

Hope that this helps to make everyones day a little easier :-)

#!/usr/bin/perl
################################################################################
# Name: patchck.pl
# Description: Check a list of patches supplied from file patch.list
# Author: Craig A. Sharp
# Syntax: patchck
# Options: None
# Version: 1.0.0
# Date: 11/15/2001
################################################################################
# Change Log:
# Date Programmer Description
# ---------- --------------- -------------------------------------------------
################################################################################

$patchfile = "/home/admin/patch_check/patch.list";
$results = ">/home/admin/patch_check/result.list";

open (listfile, $patchfile) || die "$!";
open (resultfile, $results) || warn "$!";

@patchlist = ;

foreach $patch (@patchlist) {

chomp ($patch);

print "-----------------------------------------------------------\n";
print "Checking for patch $patch....\n";
print "\n";

unless (!system "swlist -l patch | grep $patch") {
print resultfile "Patch $patch is not installed.\n";
}
else {
print resultfile "Patch $patch is installed.\n";
}

print "\n";
print "-----------------------------------------------------------\n";

}

close listfile;
close resultfile;

Craig