#!/usr/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/printServer/sbin/cl_print_server_powerpc_stop.sh 1.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2010 # 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 # @(#)04 1.1 src/43haes/usr/sbin/cluster/sa/printServer/sbin/cl_print_server_powerpc_stop.sh, hacmp, 61haes_r714 11/28/11 15:16:19 ############################################################################### # # Name: cl_print_server_powerpc_stop # # Description: # Command used as the PowerHA SystemMirror Application Server "Stop Script" for # PowerPC print subsystem. # # Syntax: # cl_print_server_powerpc_stop # # Arguments: # N/A # # Returns: # 0 on SUCCESS # 1 on FAILURE # ############################################################################### . /usr/es/lib/ksh93/func_include ############################################################################### # # Name: isRunning # # Description: Check to see if PowerPC print subsystem is active. # # Arguments: none # # Returns: 0 on RUNNING # 1 on NOT RUNNING # ################################################################################ isRunning() { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : PowerPC print subsystem to be active, following daemons should be active : qdaemon, writesrv and lpd # RC=0 DAEMONS="lpd qdaemon writesrv" KLIB_SA_logmsg INFO 3 6 print_server_sa.cat "The PowerPC print subsystem is active, \ if \"lpd\", \n\ \"qdaemon\", and \"writesrv\" daemons are active\n" for daemon in $DAEMONS do KLIB_SA_logmsg INFO 3 7 print_server_sa.cat "Verifying %1\$s daemon\n" "$daemon" LC_ALL=C /usr/bin/lssrc -s $daemon | grep -iw active >> $LOG_FILE 2>&1 if (( $? == 0 )); then KLIB_SA_logmsg INFO 3 8 print_server_sa.cat "%1\$s daemon is active\n" "$daemon" else KLIB_SA_logmsg INFO 3 9 print_server_sa.cat "%1\$s daemon is not active\n" "$daemon" (( RC = $RC + 1 )) fi done (( $RC == 3 )) && { KLIB_SA_logmsg WARN 3 2 print_server_sa.cat "%1\$s print \ subsystem is not active\n" "PowerPC" return 1 } # : Some of the required daemons are active, : which means the print subystem is partially active. # (( $RC > 0 )) && { return 0 } # : All required daemons are active which means : PowerPC print subsystem is active # KLIB_SA_logmsg INFO 3 10 print_server_sa.cat "The required daemons for %1\$s \ print subsystem are active\n" "PowerPC" KLIB_SA_logmsg INFO 3 1 print_server_sa.cat "%1\$s print subsystem is active\n" "PowerPC" return 0 } ############################################################################### # # Name: doStop # # Description: Stops the PowerPC print subsystem. # # Arguments: none # # Returns: 0 on SUCCESS # 1 on FAILURE # ################################################################################ doStop() { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : Stops the spooler group, which includes : qdaemon, writesrv, and lpd daemons. # /usr/bin/stopsrc -g spooler >> $LOG_FILE 2>&1 sleep 10 # : Check the status of PowerPC print subsystem # isRunning (( $? == 0 )) && { KLIB_SA_logmsg WARN 4 1 print_server_sa.cat "All the required daemons \ are unable to stop\n" KLIB_SA_logmsg INFO 4 2 print_server_sa.cat "%1\$s print subsystem \ has not been stopped\n" "PowerPC" return 1 } KLIB_SA_logmsg INFO 4 3 print_server_sa.cat "%1\$s print subsystem has been stopped\n" "PowerPC" 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/printServer/sbin/cl_print_server_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 print_server_sa.cat 5 "# POWERPC PRINT SUBSYSTEM STOP LOG" >> $LOG_FILE echo "\n######################################################" >> $LOG_FILE # : Check the status of PowrePC print subsystem # isRunning (( $? == 0 )) && { KLIB_SA_logmsg INFO 4 4 print_server_sa.cat "Stopping %1\$s print subsystem\n" "PowerPC" # : PowerPC print subsystem is active. : Make an attempt to stop PowerPC print subsystem. # doStop exit $? } exit 0