Operating System - HP-UX
1838652 Members
4011 Online
110128 Solutions
New Discussion

Package start script or utility

 
Scott Tinsley
Advisor

Package start script or utility

Has anyone developed a script that accesses a package configuration file and then starts the package outside of the cluster, i.e. imports the VGs, lights up the IP addresses and starts the associated applications. This would be useful in cases where cluster or package maintenance needs to be performed but packages still need to be available.
10 REPLIES 10
Ralph Grothe
Honored Contributor

Re: Package start script or utility

Hi Scott,

I did something similar but was too lazy to "reinvent the wheel" and rescript all those handy custom functions the cmmakepkg command provides as a template.
Thus I extracted what seemed reusable from there, and sourced it in my script to invoke those functions.
Maybe also an option for you?

The part that did this looks something like this:

# code reuse of handy functions
TMP_CMLIB=$(mktemp)
cmmakepkg -s |\
sed -n '/# START OF RUN FUNCTIONS/,/# END OF FUNCTIONS COMMON TO BOTH RUN AN
D HALT/p' \
> $TMP_CMLIB
if [ -s $TMP_CMLIB ]; then
echo "Dumped custom functions to $TMP_CMLIB"
. $TMP_CMLIB
echo "Sourced custom functions from $TMP_CMLIB:"
typeset -f|grep function
fi
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Package start script or utility

Look at the bottom of your package control script (viz. the "main" block) how these functions are called during a normal package stop|start.
I also inserted a custom function that touch-es some sort of semaphore file to indicate that the cluster services should start up in maintenance mode.
Then in the customer_defined_*_cmds() funcs there are test blocks that look for this file, and if found only do VG activation, FS checking and mounting, IP address binding etc. (whatever your needs are).
After ending maintenance one has to halt the packages with the semaphore file in place, then remove the file and restart normally.
Madness, thy name is system administration
Scott Tinsley
Advisor

Re: Package start script or utility

I see where you are heading with this. Do the functions in the package control script depend on the cluster actually be active an running?
Sridhar Bhaskarla
Honored Contributor

Re: Package start script or utility

Hi Scott,

I have never gotten to situations where I had to do like this. However as long as you have the 'cluster' up and running, you should be able to use 'package.cntl start|stop' to bring up/down the package outside serviceguard. However, you will not be able to bring up/down the services and resources even if serviceguard is running as they use cm*serv and cm*res commands. And you will have to modify it quite a bit like changing 'cmmodnet' command to 'ifconfig' etc., if the cmcld process is not running.


-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Scott Tinsley
Advisor

Re: Package start script or utility

Turns out that if you just source the package control script and the cluster is running, you can call the appropriate fucntions and essentially activate the package without knowledge of the cluster. For instance,

cd /etc/cmcluster/pkg
. ./pkg.cntl
activate_volume_group
check_and_mount
add_ip_address
customer_defined_run_cmds

This should work when the cluster is down except you cannot do a vgchange -a e (exclusive) with cluster services down. I assume you could export the VG and then reimport and mark as not sharable.

Thanks for the insite
Ralph Grothe
Honored Contributor

Re: Package start script or utility

If you need to activate the shared VG I think you have to revoke the "cluster bit" by something like

vgchange -c n vgXX

Issueing this command, however seems to require a running cmlvmd daemon which is part of cluster services of a running cluster.
So a bit like the hen and egg catch once again?
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Package start script or utility

Oops, I have to correct myself after rebrowsing through man vgchange



-c cluster Control the membership of volume groups in a
high availability cluster. cluster can have
one of the following values:

y Mark each specified volume group as
a member of the high availability
cluster. The high availability
software must be running;
otherwise, the volume group is not
marked. Needs to be done on one
node only.

n Remove each specified volume group
from membership in the high
availability cluster. The high
availability software does not need
to be running.



So revocation shouldn't be the problem.
But if my memory serves me correctly I can recall once having had enormous difficulties to reset the bit in absence of cluster services.
Unfortunately I have only productive servers under my "reign", where I cannot get hands on to give it try right now.
Madness, thy name is system administration
Sridhar Bhaskarla
Honored Contributor

Re: Package start script or utility

Scott,

If the cluster is down, you will not be able to add the package IP address either as 'cmmodnet' fails if it doesn't find cmcld process. You will need to use ifconfig to bypass that issue. The best bet is to have atleast the cluster up and running for minimum modifications.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Stephen Doud
Honored Contributor

Re: Package start script or utility

Consider this document:
DKKBRC00006487
(locate by document ID in the Knowledge Database search tool)

-SD.
Scott Tinsley
Advisor

Re: Package start script or utility

Thanks for all the great leads. Using the functions in the package control script accomplishes about 95% of what I was looking to do. If I wrap calls to those functions in a script to handle management of the VGs when the cluster is down, I will have what I need.

Thanks for all your help and quick responses.