Serviceguard

how to add external script service guard package

 
rcampbell
Occasional Visitor

how to add external script service guard package

Hello currently I have a 3 node cluster (SG), sorry for my english but anyways, how can i start an external script to run only when package is up and running  , lets said I have this separete script in a certain path:

/opt//scripts/hello._start.sh

so how can i run that script when the package of the cluster is up please any help will be appreciated.

4 REPLIES 4
Ihaqueit
Regular Advisor

Re: how to add external script service guard package

Modify "script control package":

customer_defined_halt_cmds:

su - oracle -c /etc/cmcluster/examples/script_to_stop_oracle

customer_defined_run_cmds:

su - oracle -c /etc/cmcluster/examples/script_to_start_oracle

Copy "script control package" to other nodes of cluster.

rgs,

rgs,

I Haq
rcampbell
Occasional Visitor

Re: how to add external script service guard package

package_description "Serviceguard Package"


module_name sg/basic
module_version 1
module_name sg/all
module_version 2
module_name sg/failover
module_version 1
module_name sg/priority
module_version 1
module_name sg/pr_cntl
module_version 2
module_name sg/dependency
module_version 1
module_name sg/weight
module_version 1
module_name sg/monitor_subnet
module_version 1
module_name sg/package_ip
module_version 1
module_name sg/service
module_version 1
module_name sg/generic_resource
module_version 1
module_name sg/volume_group
module_version 1
module_name sg/filesystem
module_version 1
module_name sg/pev
module_version 1
module_name sg/external_pre
module_version 1
module_name sg/external
module_version 1
module_name sg/acp
module_version 1
module_name sg/vmfs
module_version 1
module_name sg/vmfs_validate_end
module_version 1
module_name dts/mcxpca
module_version 1
module_name dts/xpca
module_version 1


package_type failover


node_name *


auto_run yes


node_fail_fast_enabled no
run_script_timeout no_timeout
halt_script_timeout no_timeout
successor_halt_timeout no_timeout

script_log_file $SGRUN/log/$SG_PACKAGE.log

operation_sequence $SGCONF/scripts/dts/xpca.sh
operation_sequence $SGCONF/scripts/sg/external_pre.sh
operation_sequence $SGCONF/scripts/sg/vmfs.sh
operation_sequence $SGCONF/scripts/sg/pr_cntl.sh
operation_sequence $SGCONF/scripts/sg/volume_group.sh
operation_sequence $SGCONF/scripts/sg/filesystem.sh
operation_sequence $SGCONF/scripts/sg/package_ip.sh
operation_sequence $SGCONF/scripts/sg/external.sh
operation_sequence $SGCONF/scripts/sg/service.sh
operation_sequence $SGCONF/scripts/sg/vmfs_end_val.sh


failover_policy site_preferred_manual
failback_policy manual
priority no_priority
ip_subnet x.x.x.x
ip_subnet_node hello1
ip_subnet_node hello2
ip_address x.x.x.x
ip_subnet x.x.x.x
ip_subnet_node 3nodefordisasterevoery (example)
ip_address x.x.x.x

dts/xpca/AUTO_PSUEPSUS 0
dts/xpca/AUTO_FENCEDATA_SPLIT 1
dts/xpca/AUTO_SVOLPSUS 0
dts/xpca/AUTO_SVOLPSUE 0
dts/xpca/AUTO_SVOLPFUS 0
dts/xpca/AUTO_PSUSSSWS 0
dts/xpca/AUTO_NONCURDATA 1
dts/xpca/MULTIPLE_PVOL_OR_SVOL_FRAMES_FOR_PKG 0
dts/xpca/HORCMPERM MGRNOINST
dts/xpca/HORCMINST 50
dts/xpca/HORCTIMEOUT 360
dts/xpca/WAITTIME 300
dts/xpca/FENCE async
dts/xpca/DEVICE_GROUP gvt6755_CA
dts/xpca/dts_pkg_dir $SGCONF/gct11559
dts/xpca/CLUSTER_TYPE metro

vgchange_cmd "vgchange -a y"
vxvol_cmd "vxvol -g \${DiskGroup} startall"
vg vg03
vxvm_dg_retry no

deactivation_retry_count 2
kill_processes_accessing_raw_devices no
concurrent_fsck_operations 1
concurrent_mount_and_umount_operations 1
fs_mount_retry_count 0
fs_umount_retry_count 1
fs_name /dev/vg03/lvol01
fs_server ""
fs_directory /u01/app/oracle/product
fs_type "xfs"
fs_mount_opt ""
fs_umount_opt ""
fs_fsck_opt ""
fs_name /dev/vg03/lvol02
fs_server ""
fs_directory /var/opt/pdb-in
fs_type "xfs"
fs_mount_opt ""
fs_umount_opt ""
fs_fsck_opt ""
fs_name /dev/vg03/lvol03
fs_server ""
fs_directory /opt/TidalSG1
fs_type "xfs"
fs_mount_opt ""
fs_umount_opt ""
fs_fsck_opt ""
fs_name /dev/vg03/lvol04
fs_server ""
fs_directory /opt/pdb-in
fs_type "xfs"
fs_mount_opt ""
fs_umount_opt ""
fs_fsck_opt ""


So in all This script which is the package scrit so I add the lines you mention
customer_defined_halt_cmds:

su - oracle -c /etc/cmcluster/examples/script_to_stop_oracle

su - oracle -c /etc/cmcluster/examples/script_to_start_oracle

customer_defined_run_cmds:

su - oracle -c /etc/cmcluster/examples/script_to_start_oracle


bu tus I dont know where I guess is that script control package I have the following directories :

AutoPass cmcluster.rc config.lck
cmanalytics.conf cmcluster.rc.default examples
cmappmgr.conf.default cmcluster_service gct11559
cmclconfig cmknowncmds gct11559.old
cmclconfig.ascii cmlicmon ll_authfile
cmclconfig.ascii1 cmlicmon.service modules
cmclconfig.ascii.bkp cmlicmon.timer schemas
cmclconfig.tmp cmproxy scripts
cmclfiles2check cmproxyd sglxpdf.txt
cmclfiles2check.default cmproxy.service SGSafetyTimer
cmclnodelist cmscripts2verify SGSafetyTimer_service
cmcluster.conf.default cmsnmpd SGSafetyTimer.service
cmcluster.init cmsnmpd_service simulator
cmcluster.init.service cmsnmpd.service simulator_template
[root@g7t12213x conf]# cd scripts
[root@g7t12213x scripts]# ls
cluster_master_script.sh cmcheck_features ext ntp_conf_check.sh
cluster_master_script_utils.sh dts mscripts sg
[root@g7t12213x scripts]#

Mike_Chisholm
Advisor

Re: how to add external script service guard package

I'm assuming you're using a modern version of SGLX with modular packages, so the customer_defined_run_cmds and customer_defined_halt_cmds have been replaced by the new external_script which uses start_command and stop_command functions though people may still use the old conventions when talking about it. Your custom script needs to be added to the "external_script" variable in the package configuration file (which is most likely commented out).

A template for the actual script can be found in  $SGCONF/examples/external_script.template, so you would copy this template to some place on your server (maybe /usr/local/bin or maybe some specific application subdirectory or whatever) and then you use that path as the argument for external_script. For example:
# cp -p $SGCONF/examples/external_script.template $SGCONF/pkg1/pkg1.external.sh

You then edit the $SGCONF/pkg1/pkg1.external.sh and in there you will find the start_command and stop_command functions where you actually add your custom logic and command (don't forget error handling!) to do whatever you need the script to do when the package is starting and stopping. Once the file is properly modified you need to distribute it to all nodes and then edit the package configuration file and put its path in the external_script variable. For example:

external_script $SGCONF/pkg1/pkg1.external.sh

Then you can do your cmapplyconf to make it active. There are extensive comments in the template and the package config file that will help and you might also refer to the manual here - https://support.hpe.com/hpesc/public/docDisplay?docId=a00112891en_us&docLocale=en_US&page=chdcgiaf.html

 

rcampbell
Occasional Visitor

Re: how to add external script service guard package

Hello Mike thank you very much as soon im done with something i back to review your comments and check if possible to configure this!