Operating System - HP-UX
1833861 Members
2232 Online
110063 Solutions
New Discussion

Re: Starting/Stopping package

 
SOLVED
Go to solution
Dee Jacobs
Advisor

Starting/Stopping package

This is my first package. It is a simple perl program just for testing. It just logs its existence at periodic intervals.

I have trouble identifying the method of starting and stopping the package. I see that is is effected from tkit_module.sh.
#############################################################
#
# START FUNCTION
#
############################################################

function start_function
{
. $APP_TKIT_APP_START
exit_code=$?
}

#############################################################
#
# STOP FUNCTION
#
############################################################

function stop_function
{

. $APP_TKIT_APP_STOP
exit_code=$?

}
Where are these two environment variables defined and how do I get them to point to my start and stop scripts? I have tested the scripts using sh -x and they work fine.
SMH says the package has started and the /var/adm/cmcluste/log/... says it was successful, but the start script never ran.
4 REPLIES 4
Rita C Workman
Honored Contributor

Re: Starting/Stopping package

Well...in 11.19 there is a directory called /etc/cmcluster/scripts that has this module for a variety of things. So far I haven't had need to use it.

Generally, once I create a package, which I tend to keep at this path:
/etc/cmcluster/packages/

It creates two files, the ascii (HA Package Configuration File) and under it is put the path location of where to run:
RUN_SCRIPT /etc/cmcluster/packages// start file
HALT_SCRIPT /etc/cmcluster/packages// halt file

Now those two files just mentioned come from that second file the pkg creation task created and it is called the HA Package Control Script.
In this .cntl or Control Script file you have a section called:
function customer_defined_run_cmds
and
function customer_defined_halt_cmds

Under these sections you put in the path/file names of the scripts that kick off your oracle environment or special scripts that need to run to start up (or stop) your processes.
The file systems would be defined in this file and would be mounted up as definined in that section.

All of this is covered at docs.hp.com under High Availability. Nothing works better than a good read to get you started in the right direction.

http://docs.hp.com/en/ha.html

Regards,
Rita
Stephen Doud
Honored Contributor
Solution

Re: Starting/Stopping package

The technique for implementing external scripts that are identified by the modular package configuration file is discussed in the A.11.18 (2008 edition) and A.11.19 (2009 editions) of the Managing Serviceguard manual at http://docs.hp.com/en/ha.html -> Serviceguard.

If you have a software contract and access to the ITRC knowledge database, search for emr_na-c01987897
Title: "HPUX Serviceguard - Implementing external scripts in modular packages"

In summary, first, make a modular package configuration file:
cmmakepkg -n

Edit it and uncomment
#external_script

Example:
external_script /etc/cmcluster/
If you haven't already done so, copy the external script template to the target path:
# cd /etc/cmcluster/
# cp ../examples/external_script.template
The template gives specific instructions on how to edit it but basically:

function start_command
{
sg_log 5 "start_command"
# ADD your package start steps here
return 0
}

and

function stop_command
{
sg_log 5 "stop_command"
# ADD your package halt steps here
return 0
}

Finally, cmapplyconf the package configuration file (the one created with cmmakepkg) to update the cluster with this new package, then use cmrunpkg to test it.
The package start/stop log will be in /var/adm/cmcluster/logs unless you customized that.
Dee Jacobs
Advisor

Re: Starting/Stopping package

Thank you, Stephen.
I work overnite and I spent some time with SMH. While editing sg/external for the package, I was able to figure that out using SMH.

Your steps are very clear for the solution outside of SMH.

I did have a lot of trouble understanding Rita's answer - never did get it.
Dee Jacobs
Advisor

Re: Starting/Stopping package

Stephen Doud's explanation was very clear and confirmed the approach I was heading for.