Operating System - HP-UX
1830009 Members
2397 Online
109998 Solutions
New Discussion

MC/SG Service Scripts / Halting

 
Justin Willoughby
Regular Advisor

MC/SG Service Scripts / Halting

Hi All,

I have a new MC/SG cluster I am setting up.

I have three services and one startup and shutdown script.

The three service scripts launch another process in the foreground so that if the process dies it will get re-started. This seems to work fine but when I halt the cluster, MC/SG kills the script and then the process dies right away. One of the process usually takes 30 to 60 seconds to stop when killed normally.

If in the service script file I put a exec in front of the program I am launching, MC/SG will wait while the service stops (process is killed). This seem to me like what I should it so that any service process I launch is allowed to fully exit.

Is this the best way to do this or are there other suggestions?

Thanks!

- Justin
3 REPLIES 3
Dietmar Konermann
Honored Contributor

Re: MC/SG Service Scripts / Halting

Justin,

you need to configure a SERVICE_HALT_TIMEOUT for the services in question in your package configuration.

See the comments in SG's configration template:

# SERVICE_HALT_TIMEOUT is represented in the number of seconds.
# This timeout is used to determine the length of time (in
# seconds) the cluster software will wait for the service to
# halt before a SIGKILL signal is sent to force the termination
# of the service. In the event of a service halt, the cluster
# software will first send a SIGTERM signal to terminate the
# service. If the service does not halt, after waiting for the
# specified SERVICE_HALT_TIMEOUT, the cluster software will send
# out the SIGKILL signal to the service to force its termination.
# This timeout value should be large enough to allow all cleanup
# processes associated with the service to complete. If the
# SERVICE_HALT_TIMEOUT is not specified, a zero timeout will be
# assumed, meaning the cluster software will not wait at all
# before sending the SIGKILL signal to halt the service.


Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Justin Willoughby
Regular Advisor

Re: MC/SG Service Scripts / Halting


Thanks for the reply. I do have SERVICE_HALT_TIMEOUT set to 120.

The problem is a basic one I think. Say you have the following script named testapp:

===========Start=============
export VAR1=test
export VAR2=test2

/path/to/app/appname
============End==============

If you run just /path/to/app/appname it will take it 30 to 60 seconds to shutdown once killed. However if you run the testapp script and kill the testapp script, appname will not take the normal 30 to 60 seconds to shutdown. Because the script that was running it was killed.

If I change my script to have exec in front of the /path/to/app/appname then when the script/sg service is killed it will take its normal time to shutdown.

- Justin
David Totsch
Valued Contributor

Re: MC/SG Service Scripts / Halting

Justin:

Have you tried replacing the service command string (where you currently would have "/path/to/testapp") with a direct call to the application? Yes, you can get the environment variables set, like this:

VAR1=test VAR2=test2 /path/to/application

-dlt-