Skip Navigation Links
Exit Print View
| Oracle Solaris Cluster Data Services Developer's Guide Oracle Solaris Cluster 4.1

Search Scope:

- This Document
- Entire Library

## `Monitor_stop` Method Code Listing

This method stops the `PROBE` program for the data service.

Example A-7 `dns_monitor_stop` Method

    #!/bin/ksh
    # Monitor stop method for HA-DNS
    # Stops the monitor that is running using PMF.

    #pragma ident   “@(#)dns_monitor_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.monitor
    SYSLOG_TAG=$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME

    # See if the monitor is running, and if so, kill it.
    if pmfadm -q $PMF_TAG.monitor; then
       pmfadm -s $PMF_TAG.monitor KILL
       if [ $? -ne 0 ]; then
          logger -p ${SYSLOG_FACILITY}.err -t [$SYSLOG_TAG] \
              “${ARGV0} Could not stop monitor for resource “ \
              $RESOURCE_NAME
               exit 1
       else
          # Could successfully stop the monitor. Log a message.
          logger -p ${SYSLOG_FACILITY}.info -t [$SYSLOG_TAG] \
              “${ARGV0} Monitor for resource “ $RESOURCE_NAME \
              “ successfully stopped”
       fi
    fi
    exit 0

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices |