#!/usr/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r720 src/43haes/usr/sbin/cluster/sa/filenet/sbin/cl_filenet_process_engine_monitor.sh 1.3 # # 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 # @(#)88 1.3 src/43haes/usr/sbin/cluster/sa/filenet/sbin/cl_filenet_process_engine_monitor.sh, hacmp, 61haes_r720, 1539B_hacmp720 9/11/15 15:16:42 #----------------------------------------------------------------------------- # # Name: usage # # Prints usage message and exits the program. # # Arguments: none # # Returns: does not return # usage() { set +u [[ "$VERBOSE_LOGGING" == "high" ]] && set -x set -u KLIB_SA_logmsg WARN 4 1 filenetsa.cat "Usage:\ncl_filenet_process_engine_monitor [-D | -v] -u PROCESS_ENGINE_USER_NAME\n" exit 1 } #---------------------------------------------------------------------------- # # Name: doCMon # # Description: # Verify process engine is healthy # # Arguments: none # # Global Variables: # PE_USER_NAME # # Returns: # 0 on SUCCESS # 1 on FAILURE # doCMon() { if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_FUNC=doCMon set -x fi KLIB_SA_logmsg INFO 6 2 filenetsa.cat "Process Engine Health check initiated\n" echo | /usr/bin/su - $PE_USER_NAME -c "LC_ALL=C initfnsw -y status | grep -i \"software started\"" >> $LOG_FILE 2>&1 (( $? == 0 )) && { KLIB_SA_logmsg INFO 4 2 filenetsa.cat "Process Engine is active\n" return 0 } KLIB_SA_logmsg INFO 4 3 filenetsa.cat "Process Engine is not active\n" return 1 } ############################################################################### # Main program procedure. ############################################################################### PROGNAME=${0##*/} PATH=$(/usr/es/sbin/cluster/utilities/cl_get_path all) FPATH_BASE=/usr/es/lib/ksh93 FPATH=$FPATH_BASE/hacmp:$FPATH_BASE/sa:$FPATH_BASE/aix:$FPATH_BASE/aix/odm # # Process Engine path is set to PATH variable # PE_BIN_PATH=$(lslpp -cw '*/bin/initfnsw' | tail -1 | cut -d ':' -f 1) PE_BIN_PATH=${PE_BIN_PATH%initfnsw} PATH=$PATH:$PE_BIN_PATH export PATH FPATH # Load the common variables . /usr/es/sbin/cluster/sa/filenet/sbin/cl_filenet_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" # We need to set this so that we can gather enough details in # /var/hacmp/log/clappmond..monitor.log for debugging. export VERBOSE_LOGGING=${VERBOSE_LOGGING:-"high"} eval export $(cllsparam -n $(clodmget -f nodename HACMPcluster)) if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_TIMER=true set -x version='1.3' fi DEBUG=${DEBUG:-"0"} VERBOSE=${VERBOSE:-"0"} PE_USER_NAME="" BASENAME=${0##*/} while getopts vDu: option do case $option in u) # Process Engine User name PE_USER_NAME=$OPTARG ;; D) # Verbose on + Debug on VERBOSE=1 DEBUG=1 shift ;; v) # Verbose on VERBOSE=1 shift ;; *) # Usage usage esac done echo "######################################################" >> $LOG_FILE dspmsg -s 4 filenetsa.cat 3 "# PROCESS ENGINE MONITOR LOG" >> $LOG_FILE echo "######################################################" >> $LOG_FILE if [[ "$PE_USER_NAME" == "" ]]; then KLIB_SA_logmsg ERROR 2 6 filenetsa.cat "Process Engine user is missing\n" usage fi doCMon # We will error out if doCMon() returns non-zero. exit $?