Today I needed to see what patches were missing on a ton of machines. Instead of trying to start the Patch manager of the month for solaris, I wrote this little script that would produce me a HTML page of the current patches installed and ones that needed to be installed. This script is based off of the patchdiag.xref available from Sun. I know there are many other tools out there such as PCA (Patch check advanced) but in the environment I was in today, I could not use any third party programs so I wrote my own. The output looks like this:
What the script does is the following:
- Get a list of current patches on the machine
- Find the latest version of each patch that is installed on the machine and compare it to the latest version available according to the patchdiag.xref
- Generate one line of HTML code, listing the patch, the current installed revision and the current available revision and a description of the patch. It will also place a link to the patch on sunsolve.
- At the end it will list a summary of patches installed, missing, obsolete, and how many security and recommended patches there are.
- It will then compare the list of currently available patches against what is installed to see if there are patches that are available but not installed on the system
- If a patch has never been installed it will then list the line of HTML code showing the patch number, revision, flag (security,recommended) and its description
- At the end it will display the total number of patches that are not installed and how many are recommended and/or security
Basically it is a very simple script. It should work on all versions of solaris from 7+. It ONLY looks at Solaris specific patches and not those that are unbundled (i.e. Sun Studio, Web Server, etc.)
Here is the script, it may not be the cleanest or most efficient, but it was a quick job…
Shell script to analyze solaris patches