Operating System - HP-UX
1748259 Members
3943 Online
108760 Solutions
New Discussion

Re: Command to get the package name related with the vg

 
shikhar_1
Regular Advisor

Command to get the package name related with the vg

Hi,

 

Can anyone please let me know any command which will give the name of the package related with the vg name?

 

Like suppose i know one vg(vg_db01) and i just wanted to know which package is associated with this vg. Lets suppose there are more then 100 packages  running on the server so it would be diffficult to check it manually.

 

Thanks for your response.

5 REPLIES 5
Jeff_Traigle
Honored Contributor

Re: Command to get the package name related with the vg

There's now one command that will do it, but the following script should do the trick:

 

#!/usr/bin/sh

VG=$1
PKGS="$(cmviewcl -l package | grep -v PACKAGE | grep -v "^$" | awk '{print $1}')"

for PKG in ${PKGS}
do
  cmgetpkgenv ${PKG} | grep ${VG} > /dev/null 2>&1
  RC=$?

  if [ ${RC} -eq 0 ]
  then
    echo "Volume group ${VG} is used by the ${PKG} package."
    exit 0
  fi
done

 

--
Jeff Traigle
shikhar_1
Regular Advisor

Re: Command to get the package name related with the vg

cmgetpkgenv  is not working..

 

Can u give some other command for the same?

Torsten.
Acclaimed Contributor

Re: Command to get the package name related with the vg

Can you please explain what "cmgetpkgenv is not working.." means? Any error messages???

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Jeff_Traigle
Honored Contributor

Re: Command to get the package name related with the vg

I guess you are running Serviceguard prior to A11.18 then. The following command should work to check the control script in older versions of Serviceguard:

 

grep "^VG\[[0-1]*\]=/dev/${VG}" /etc/cmcluster/${PKG}/control.sh > /dev/null 2>&1

 

You may need to adjust the path for the control script if your layout is different.

--
Jeff Traigle
Stephen Doud
Honored Contributor

Re: Command to get the package name related with the vg

If it is not already obvious, LVM volume groups are associated with packages.  As of A.11.18, Serviceguard supports 2 styles of packages - legacy, which involve a package configuration file and a package control script, and modular, which uses a package configuration file that is loaded with all parameters previously defined in the 2 legacy files.  Modular package parameters are compiled into the cluster binary file, which make it possible to identify all volume groups related to packages by using this command:

$ cmviewcl -v -f line | grep vg=

 

The legacy package control script contains the VG[x]=  parameters, so you have to use the grep command Jeff gave to relate the VGs to the packages.