Showing results for 
Search instead for 
Did you mean: 

To run a script in linux servicegurd

Md. Zubair Hoque
Occasional Advisor

To run a script in linux servicegurd

we have had on to start dgw (node name)
service with VIP package, we have and shell
scripts. We need these scripts should start/stop whenever there is VIP
package start/stop. On other way, VIP package start command (cmrunpkg)
would take care of starting dgw service by executing script
automatically. Similarly VIP package stop command (cmhaltpkg) would take
care executing script. Can we configure the service guard a
way we mentioned above. Please let me know. Thanks.
Honored Contributor

Re: To run a script in linux servicegurd

Yes, there's a place in the package control script for things like this.

Search the control script for "customer_defined_run_cmds" and "customer_defined_halt_cmds". You can add anything you need to these two shell functions.

Remember that if any of the added commands returns an error code, ServiceGuard will assume it means that something went wrong and sysadmin's actions will be required to avoid data loss.

The start script should be able to start the application even though it may not be shut down in a controlled manner. This is for the occasion when a package failover happens because the primary node has completely crashed.

When the "customer_defined_halt_cmds" function has been completed successfully, there should be no more application processes accessing the package disks. ServiceGuard will try to unmount the package disks _immediately_ after completing the "customer_defined_halt_cmds". Your stop script should be designed with this in mind.

Steven E. Protter
Exalted Contributor

Re: To run a script in linux servicegurd


Sounds like a job for the package control script.

Doesn't matter whether the link above is linux or hpux it works the same way.

Steven E Protter
Owner of ISN Corporation
Md. Zubair Hoque
Occasional Advisor

Re: To run a script in linux servicegurd

For any critical alarm, DGW sends SNMP traps to remote NMS. Is there any provision with service guard to send alarm? Let me put this way, if dgw cluster goes down then alarm should generate and it should be sent to remote monitoring tool. Is this possible with hp service guard? Please let me know. Thanks.

joseph pareti
Frequent Advisor

Re: To run a script in linux servicegurd

I would like to chime in since I have got a similar question/problem: specifically I am using SGLX A 11.18 on rhel4 and I would like to integrate an app in the package. According to the "Managing HP SG for Linux, 7th edition" guide, the way to do it, is by using a "legacy package" (the terminology is IMO somehow misleading), and to use the RUN_SCRIPT, HALT_SCRIPT entries in the package configuration file. My question is that these entries were not created for me whan I ran
# cmmakepkg $SGCONF/pkg1/pkg1.conf

In addition, there is a whitepaper "Framework for HP Serviceguard Toolkits" explaining the integration: appendix B lists a sample integration with MySQL, and also refers to RUN_SCRIPT, HALT_SCRIPT in the pkg config. file.

Is it correct to go ahead and edit pkg1.conf ?

Why does it not get set by cmmakepkg?
Or am I missing anything else?

Md. Zubair Hoque
Occasional Advisor

Re: To run a script in linux servicegurd

Problem solved.