#!/bin/ksh93 # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2020,2021. All rights reserved. # # ALTRAN_PROLOG_END_TAG # # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/lib/ksh93/hacmp/KLIB_HACMP_collect_logs.sh 1.4 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1990,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 # @(#) 7d4c34b 43haes/lib/ksh93/hacmp/KLIB_HACMP_collect_logs.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM #================================================ # The following, commented line enforces coding # standards when this file is edited via vim. #================================================ # vim:tabstop=4:shiftwidth=4:expandtab:smarttab #================================================ # Start of POD-formatted documentation. Viewing suggestions: # perldoc # pod2text -c # pod2text -c --code # pod2html function devDoc { : <<'=cut' >/dev/null 2>&1 =head1 NAME KLIB_HACMP_collect_logs =head1 VERSION Version Number: 1.4 Last Extracted: 1/31/14 04:41:03 Last Changed: 10/28/13 16:42:16 Path, Component, Release(, Level): src/43haes/lib/ksh93/hacmp/KLIB_HACMP_collect_logs.sh, hacmp.assist, 61haes_r714 =head1 SYNOPSIS clmgr collect logs \ [ DIRECTORY="" ] \ [ NODES=[,,,...] ] \ [ RSCT_LOGS={yes|no} ] \ =head1 DESCRIPTION Collects the PowerHA logs and various other service information. =head1 ARGUMENTS 1. DIRECTORY [OPTIONAL] [string] An alternate directory into which the collected logs will be placed. 2. NODES [OPTIONAL] [string] One or more nodes from which to retrieve the logs (defaulting to the local node). 3. RSCT_LOGS [OPTIONAL] [string] A Boolean-like indicator of whether or not the RSCT logs should also be collected (along with the PowerHA logs). =head1 RETURN 0: no errors were detected; the operation appears to have been successful 1: a general error has occurred 2: a specified resource does not exist, or could not be found 3: some required input was missing 4: some detected input was incorrect in some way 5: a required dependency does not exist 6: a specified search failed to match any data =head1 COPYRIGHT COPYRIGHT International Business Machines Corp. 2005,2010 All Rights Reserved =cut } # End of POD-formatted documentation. function on_exit_collect_logs { /usr/bin/rm -f $TMPDIR/clmgr.KHcl.$$ } function KLIB_HACMP_collect_logs { trap 'on_exit_collect_logs' EXIT LINENO=2 . $HALIBROOT/log_entry "$0()" "$CL" : version= @(#) 7d4c34b 43haes/lib/ksh93/hacmp/KLIB_HACMP_collect_logs.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM typeset DIRECTORY=${1//\"/} typeset NODES=${2%%+([[:space:]])} NODES=${NODES##+([[:space:]])} NODES=${NODES//+([[:space:]])/,} NODES=${NODES//\"/} typeset -l RSCT_LOGS=${3//\"/} [[ $CLMGR_LOGGING == 'med' ]] && set +x # Only trace param values #=================================== : Declare and initialize variables #=================================== typeset -i rc=$RC_UNKNOWN typeset dopt= sopt= nopt= [[ -n $DIRECTORY ]] && dopt="-d $DIRECTORY" [[ -n $NODES ]] && nopt="-n $NODES" [[ $RSCT_LOGS == @(n|f)* ]] && sopt="-s" #============================================================== : The return code from clsnap is unreliable. So we are forced : to parse the output information to determine if there is : enough space to run this operation. #============================================================== print -- "$0()[$LINENO]($SECONDS): LC_ALL=C LANG=C $HAUTILS/clsnap $dopt $nopt $sopt -p 1" >>$CLMGR_TMPLOG # Always log commands LC_ALL=C LANG=C $HAUTILS/clsnap $dopt $nopt $sopt -p 1 |\ /usr/bin/tee $TMPDIR/clmgr.KHcl.$$ if [[ ! -s $TMPDIR/clmgr.KHcl.$$ ]] || \ ! grep -q "kb Required" $TMPDIR/clmgr.KHcl.$$ || \ grep -q "not enough" $TMPDIR/clmgr.KHcl.$$ then log_return_msg "$RC_ERROR" "$0()" "$LINENO" return $? fi print -- "$0()[$LINENO]($SECONDS): $HAUTILS/clsnap $dopt $nopt $sopt -p 2" >>$CLMGR_TMPLOG # Always log commands $HAUTILS/clsnap $dopt $nopt $sopt -p 2 rc=$? print "clsnap -p 2 RC: $rc" >>$CLMGR_TMPLOG # Always log command result (( $rc != RC_SUCCESS )) && rc=$RC_ERROR log_return_msg "$rc" "$0()" "$LINENO" return $? } # End of "KLIB_HACMP_collect_logs()"