Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Solaris Cluster Data Services Developer's Guide Oracle Solaris Cluster 4.0 |
1. Overview of Resource Management
3. Resource Management API Reference
6. Data Service Development Library
8. Sample DSDL Resource Type Implementation
9. Oracle Solaris Cluster Agent Builder
12. Cluster Reconfiguration Notification Protocol
A. Sample Data Service Code Listings
Resource Type Registration File Listing
Monitor_start Method Code Listing
Monitor_stop Method Code Listing
Monitor_check Method Code Listing
B. DSDL Sample Resource Type Code Listings
C. Requirements for Non-Cluster-Aware Applications
D. Document Type Definitions for the CRNP
The RGM runs the Stop method on a cluster node when the resource group that contains the HA-DNS resource is brought offline on that node. The RGM also does so when the resource is disabled. This method stops the in.named (DNS) daemon on that node.
Example A-3 dns_svc_stop Method
#!/bin/ksh # # Stop method for HA-DNS # # Stop the data service using PMF. If the service is not running the # method exits with status 0 as returning any other value puts the resource # in STOP_FAILED state. #pragma ident “@(#)dns_svc_stop 1.1 12/01/24” ############################################################################### # Parse program arguments. # function parse_args # [args ...] { typeset opt while getopts `R:G:T:' opt do case “$opt” in R) # Name of the DNS resource. RESOURCE_NAME=$OPTARG ;; G) # Name of the resource group in which the resource is # configured. RESOURCEGROUP_NAME=$OPTARG ;; T) # Name of the resource type. RESOURCETYPE_NAME=$OPTARG ;; *) logger -p ${SYSLOG_FACILITY}.err \ -t [$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME] \ “ERROR: Option $OPTARG unknown” exit 1 ;; esac done } ############################################################################### # MAIN # ############################################################################### export PATH=/bin:/usr/bin:/usr/cluster/bin:/usr/sbin:/usr/proc/bin:$PATH # Obtain the syslog facility to use to log messages. SYSLOG_FACILITY=`scha_cluster_get -O SYSLOG_FACILITY` # Parse the arguments that have been passed to this method parse_args “$@” PMF_TAG=$RESOURCE_NAME.named SYSLOG_TAG=$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME # Obtain the Stop_timeout value from the RTR file. STOP_TIMEOUT=`scha_resource_get -O STOP_TIMEOUT -R $RESOURCE_NAME -G \ $RESOURCEGROUP_NAMÈ # Attempt to stop the data service in an orderly manner using a SIGTERM # signal through PMF. Wait for up to 80% of the Stop_timeout value to # see if SIGTERM is successful in stopping the data service. If not, send SIGKILL # to stop the data service. Use up to 15% of the Stop_timeout value to see # if SIGKILL is successful. If not, there is a failure and the method exits with # non-zero status. The remaining 5% of the Stop_timeout is for other uses. ((SMOOTH_TIMEOUT=$STOP_TIMEOUT * 80/100)) ((HARD_TIMEOUT=$STOP_TIMEOUT * 15/100)) # See if in.named is running, and if so, kill it. if pmfadm -q $PMF_TAG.named; then # Send a SIGTERM signal to the data service and wait for 80% of the # total timeout value. pmfadm -s $PMF_TAG.named -w $SMOOTH_TIMEOUT TERM if [ $? -ne 0 ]; then logger -p ${SYSLOG_FACILITY}.info -t [SYSLOG_TAG] \ “${ARGV0} Failed to stop HA-DNS with SIGTERM; Retry with \ SIGKILL” # Since the data service did not stop with a SIGTERM signal, use # SIGKILL now and wait for another 15% of the total timeout value. pmfadm -s $PMF_TAG.named -w $HARD_TIMEOUT KILL if [ $? -ne 0 ]; then logger -p ${SYSLOG_FACILITY}.err -t [SYSLOG_TAG] \ “${ARGV0} Failed to stop HA-DNS; Exiting UNSUCCESSFUL” exit 1 fi fi else # The data service is not running as of now. Log a message and # exit success. logger -p ${SYSLOG_FACILITY}.info -t [SYSLOG_TAG] \ “HA-DNS is not started” # Even if HA-DNS is not running, exit success to avoid putting # the data service in STOP_FAILED State. exit 0 fi # Successfully stopped DNS. Log a message and exit success. logger -p ${SYSLOG_FACILITY}.info -t [$SYSLOG_TAG] \ “HA-DNS successfully stopped” exit 0