#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r720 src/43haes/usr/sbin/cluster/sa/domino/sbin/cl_dominomonitor.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 
# @(#)42	1.2  src/43haes/usr/sbin/cluster/sa/domino/sbin/cl_dominomonitor.sh, hacmp.assist, 61haes_r720, 1522B_hacmp720 5/25/15 19:34:16
###############################################################################################
#
# NAME:
#       cl_dominomonitor
#
# PURPOSE:
#       monitor script of Smart Assist for Lotus domino server
#
# 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/domino/sbin/cl_lotusdominoGlobals
KLIB_HACMPLOG_ENTRY=$KLIB_LOTUS_DOMINO_HACMPLOG_ENTRY

typeset data_dir

while getopts d:p: opt
do
        case $opt in

                d) # Lotus domino server data directory
                        data_dir=$OPTARG
                        ;;
                p) # Lotus domino Program directory
                        DOMINO_PROG_DIR=$OPTARG
                        ;;
        esac
done

USER=$(ls -l $data_dir/notes.ini|awk '{print $3}')
KLIB_SA_logmsg INFO 2 22 lotusdominosa.cat "Monitoring Lotus domino server configuration for dir %1\$s\n" $data_dir
ps -fu $USER|grep -w $DOMINO_PROG_DIR/notes/latest/ibmpow/server|grep -v grep  > /dev/null 2>&1
[[ $? == 0 ]] || {
                        KLIB_SA_logmsg ERROR 2 21 lotusdominosa.cat "Failed while monitoring Lotus domino server configuration for dir %1\$s\n" $data_dir
                        exit 1
                 }
exit 0
