#!/usr/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/dns/sbin/cl_dns_stop.sh 1.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2010,2011 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)81 1.1 src/43haes/usr/sbin/cluster/sa/dns/sbin/cl_dns_stop.sh, hacmp, 61haes_r714 11/28/11 14:57:07 ############################################################################### # # Name: cl_dns_stop # # Description: Command used as the PowerHA SystemMirror Application Server # "Stop Script" for DNS. # # Syntax: cl_dns_stop # # Arguments: N/A # # Returns: 0 on SUCCESS # 1 on FAILURE # ############################################################################### . /usr/es/lib/ksh93/func_include ############################################################################### # # Name: isRunning # # Description: Check to see if DNS daemon is active. # # Arguments: none # # Returns: 0 on RUNNING # 1 on NOT RUNNING # ################################################################################ function isRunning { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : DNS daemon - named is active or not # KLIB_SA_logmsg INFO 3 1 dnssa.cat "Verifying to see DNS daemon named is active.\n" LC_ALL=C /usr/bin/lssrc -s named | /usr/bin/grep -iw active >> $LOG_FILE 2>&1 if (( $? == 0 )); then KLIB_SA_logmsg INFO 3 2 dnssa.cat "DNS daemon named is active\n" return 0 else KLIB_SA_logmsg INFO 3 3 dnssa.cat "DNS daemon named is not active\n" return 1 fi } ############################################################################### # # Name: doStop # # Description: Stops the DNS daemon named. # # Arguments: none # # Returns: 0 on SUCCESS # 1 on FAILURE # ################################################################################ function doStop { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : Stops the DNS daemon named # /usr/bin/stopsrc -s named >> $LOG_FILE 2>&1 sleep 5 # : Check the status of DNS daemon named # isRunning (( $? == 0 )) && { KLIB_SA_logmsg ERROR 4 1 dnssa.cat "DNS daemon named \ has not been stopped\n" return 1 } KLIB_SA_logmsg INFO 4 2 dnssa.cat "DNS daemon named has been stopped\n" return 0 } ############################################################################### # Main program procedure. ############################################################################### PROGNAME=$(basename ${0}) PATH="$($(dirname ${0})/../../../utilities/cl_get_path all)" PATH=$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin FPATH_BASE=/usr/es/lib/ksh93 FPATH=$FPATH_BASE/hacmp:$FPATH_BASE/sa:$FPATH_BASE/aix:$FPATH_BASE/aix/odm export PATH FPATH # : Load the common variables # . /usr/es/sbin/cluster/sa/dns/sbin/cl_dns_common_variables LOG_FILE=$(clodmget -q name=$KLIB_HACMPLOG_ENTRY -f value -d "=" HACMPlogs) LOG_FILE=${LOG_FILE//\"/} LOG_FILE="$LOG_FILE/$KLIB_HACMPLOG_ENTRY" [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DEBUG=${DEBUG:-"0"} VERBOSE=${VERBOSE:-"0"} echo "######################################################" >> $LOG_FILE dspmsg -s 4 dnssa.cat 3 "# DNS STOP LOG" >> $LOG_FILE echo "######################################################" >> $LOG_FILE # : Check the status DNS daemon named # isRunning (( $? == 0 )) && { KLIB_SA_logmsg INFO 4 4 dnssa.cat "Stopping DNS daemon named\n" # : DNS daemon named is active. : Make an attempt to stop. # doStop exit $? } exit 0