Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Cluster Data Services Developer's Guide Oracle Solaris Cluster |
1. Overview of Resource Management
3. Resource Management API Reference
6. Data Service Development Library
8. Sample DSDL Resource Type Implementation
9. 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 calls the Update method to notify a running resource that its properties have been changed.
Example A-10 dns_update Method
#!/bin/ksh # Update method for HA-DNS. # The actual updates to properties are done by the RGM. Updates affect only # the fault monitor so this method must restart the fault monitor. #pragma ident “@(#)dns_update 1.1 00/05/24 SMI” ############################################################################### # 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.monitor SYSLOG_TAG=$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME # Find where the probe method resides by obtaining the value of the # RT_basedir property of the resource. RT_BASEDIR=`scha_resource_get -O RT_basedir -R $RESOURCE_NAME \ -G $RESOURCEGROUP_NAMÈ # When the Update method is called, the RGM updates the value of the property # being updated. This method must check if the fault monitor (probe) # is running, and if so, kill it and then restart it. if pmfadm -q $PMF_TAG.monitor; then # Kill the monitor that is running already pmfadm -s $PMF_TAG.monitor TERM if [ $? -ne 0 ]; then logger -p ${SYSLOG_FACILITY}.err -t [$SYSLOG_TAG] \ “${ARGV0} Could not stop the monitor” exit 1 else # Could successfully stop DNS. Log a message. logger -p ${SYSLOG_FACILITY}.info -t [$SYSLOG_TAG] \ “Monitor for HA-DNS successfully stopped” fi # Restart the monitor. pmfadm -c $PMF_TAG.monitor -n -1 -t -1 $RT_BASEDIR/dns_probe \ -R $RESOURCE_NAME -G $RESOURCEGROUP_NAME -T $RESOURCETYPE_NAME if [ $? -ne 0 ]; then logger -p ${SYSLOG_FACILITY}.err -t [$SYSLOG_TAG] \ “${ARGV0} Could not restart monitor for HA-DNS “ exit 1 else logger -p ${SYSLOG_FACILITY}.info -t [$SYSLOG_TAG] \ “Monitor for HA-DNS successfully restarted” fi fi exit 0