#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r720 src/43haes/usr/sbin/cluster/sa/tsmclient/sbin/cl_tsmHSMclientmonitor.sh 1.2 # # 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 # @(#)39 1.2 src/43haes/usr/sbin/cluster/sa/tsmclient/sbin/cl_tsmHSMclientmonitor.sh, hacmp.assist, 61haes_r720, 1522B_hacmp720 5/25/15 19:34:26 ############################################################################################### # # NAME: # cl_tsmHSMclientmonitor # # PURPOSE: # Monitor script of Smart Assist for TSM HSM client # # ARGUMENTS: # n/a # # RETURNS # 0 on success # 1 on Failure # ################################################################################################# eval export $(cllsparam -n $(clodmget -f nodename HACMPcluster)) if [[ $VERBOSE_LOGGING == "high" ]] then PS4_TIMER=true set -x version='1.2' fi . /usr/es/sbin/cluster/sa/tsmclient/sbin/cl_tsmcliGlobals KLIB_HACMPLOG_ENTRY=$KLIB_TSM_CLIENT_HACMPLOG_ENTRY while getopts a: opt do case $opt in a) # client application name, which will be highly available app_name=$OPTARG ;; esac done sys_time=$(cat /tmp/tsmc_sys.temp|grep SYS_MOD_TIME|awk -F= '{ print $2 }' ) > /dev/null 2>&1 opt_time=$(cat /tmp/tsmc_opt.tmp|grep OPT_MOD_TIME|awk -F= '{ print $2 }' ) > /dev/null 2>&1 tsm_conf_dir=$(clodmget -q "name=TSM_CONF_DIR and application_id=$app_name" -f value -n HACMPsa_metadata) tsm_conf_dir=$(echo $tsm_conf_dir|sed 's/^[ \t]*//') sys_time=$(echo $sys_time|sed 's/^[ \t]*//') opt_time=$(echo $opt_time|sed 's/^[ \t]*//') KLIB_SA_logmsg INFO 2 81 tsmclientsa.cat "monitoring HSM and BA client\n" TSM_BIN="" lslpp -iq tivoli.tsm.client.ba.64bit.common > /dev/null 2>&1 if [[ $? == 0 ]];then TSM_BIN=$TSM_CLIENT_BA_BIN64 else TSM_BIN=$TSM_CLIENT_BA_BIN fi if [[ -n $sys_time && -f $TSM_BIN/dsm.sys ]];then sys_pres_time=$(istat $TSM_BIN/dsm.sys|grep modified|cut -d: -f 2,3,4) sys_pres_time=$(echo $sys_pres_time|sed 's/^[ \t]*//'|sed 's/\\//g'|sed 's/ //g') sys_pres_time=$(echo $sys_pres_time|cut -d: -f 1,2) sys_time=$(echo $sys_time|cut -d: -f 1,2) [[ "$sys_pres_time" == "$sys_time" ]] || { KLIB_SA_logmsg INFO 2 82 tsmclientsa.cat "Failed while monitoring HSM client dsm.sys file is changed; need to start the client again to reflect the changes\n" odmdelete -o HACMPsa_metadata -q "name=DSM_SYS_MOD_TIME and application_id=$app_name" > /dev/null 2>&1 claddsaapp -a $app_name DSM_SYS_MOD_TIME="" echo "SYS_MOD_TIME=" > /tmp/tsmc_sys.temp exit 1 } else KLIB_SA_logmsg ERROR 2 83 tsmclientsa.cat "Failed while monitoring HSM client, wrong dsm.sys is mentioned\n" exit 1 fi if [[ -n $opt_time && -f $tsm_conf_dir/dsm.opt ]];then opt_pres_time=$(istat $tsm_conf_dir/dsm.opt|grep modified|cut -d: -f 2,3,4) opt_pres_time=$(echo $opt_pres_time|sed 's/^[ \t]*//'|sed 's/\\//g'|sed 's/ //g') opt_pres_time=$(echo $opt_pres_time|cut -d: -f 1,2) opt_time=$(echo $opt_time|cut -d: -f 1,2) [[ "$opt_pres_time" == "$opt_time" ]] || { KLIB_SA_logmsg INFO 2 84 tsmclientsa.cat "Failed while monitoring HSM client dsm.opt file is changed; need to start the client again to reflect the changes\n" odmdelete -o HACMPsa_metadata -q "name=DSM_OPT_MOD_TIME and application_id=$app_name" > /dev/null 2>&1 claddsaapp -a $app_name DSM_OPT_MOD_TIME="" echo "OPT_MOD_TIME=" > /tmp/tsmc_opt.tmp exit 1 } else KLIB_SA_logmsg ERROR 2 85 tsmclientsa.cat "Failed while monitoring HSM client dsm.opt file\n" exit 1 fi ps -ef|grep -w dsmcad|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 86 tsmclientsa.cat "Failed while monitoring BA client deamon dsmcad\n" exit 1 } ps -ef|grep -w hsmagent|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 87 tsmclientsa.cat "Failed while monitoring HSM client deamon hsmagent\n" exit 1 } ps -ef|grep -w dsmrootd|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 88 tsmclientsa.cat "Failed while monitoring HSM client deamon dsmrootd\n" exit 1 } ps -ef|grep -w dsmscoutd|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 89 tsmclientsa.cat "Failed while monitoring HSM client deamon dsmscoutd\n" exit 1 } ps -ef|grep -w dsmrecalld|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 90 tsmclientsa.cat "Failed while monitoring HSM client deamon dsmrecalld\n" exit 1 } ps -ef|grep -w dsmmonitord|grep -v grep >/dev/null 2>&1 [[ $? == 0 ]] || { KLIB_SA_logmsg ERROR 2 91 tsmclientsa.cat "Failed while monitoring HSM client deamon dsmmonitord\n" exit 1 } exit 0