#!/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_systemv_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 # @(#)08 1.1 src/43haes/usr/sbin/cluster/sa/printServer/sbin/cl_print_server_systemv_stop.sh, hacmp, 61haes_r714 11/28/11 15:05:11 ############################################################################### # # Name: cl_print_server_systemv_stop # # Description: # Command used as the PowerHA SystemMirror Application Server "Stop Script" for # System V print subsystem. # # Syntax: # cl_print_server_systemv_stop # # Arguments: # N/A # # Returns: # 0 on SUCCESS # 1 on FAILURE # ############################################################################### . /usr/es/lib/ksh93/func_include ############################################################################### # # Name: isRunning # # Description: Check to see if System V print subsystem is active. # # Arguments: none # # Returns: 0 on RUNNING # 1 on NOT RUNNING # ################################################################################ isRunning() { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : Finding out System V print subsystem is active or not # LC_ALL=C /usr/bin/lpstat -r | egrep -ie "scheduler is running" >> $LOG_FILE 2>&1 (( $? == 0 )) && { KLIB_SA_logmsg INFO 3 1 print_server_sa.cat "%1\$s print subsystem is active\n" "System V" return 0 } KLIB_SA_logmsg WARN 3 2 print_server_sa.cat "%1\$s print subsystem is not active\n" "System V" return 1 } ############################################################################### # # Name: doStop # # Description: Stops the System V print subsystem. # # Arguments: none # # Returns: 0 on SUCCESS # 1 on FAILURE # ################################################################################ doStop() { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : Stops the System V print subsystem # /usr/sbin/lpshut >> $LOG_FILE 2>&1 sleep 5 # : Check the status of System V print subsystem # isRunning (( $? == 0 )) && { KLIB_SA_logmsg ERROR 4 2 print_server_sa.cat "%1\$s print subsystem \ has not been stopped\n" "System V" return 1 } KLIB_SA_logmsg INFO 4 3 print_server_sa.cat "%1\$s print subsystem has been stopped\n" "System V" 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 6 "# SYSTEM V PRINT SUBSYSTEM STOP LOG" >> $LOG_FILE echo "\n######################################################" >> $LOG_FILE # : Check the status of System V print subsystem # isRunning (( $? == 0 )) && { KLIB_SA_logmsg INFO 4 4 print_server_sa.cat "Stopping %1\$s print subsystem\n" "System V" # : System V print subsystem is active. : Make an attempt to stop System V print subsystem. # doStop exit $? } exit 0