#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# tcpip720 src/tcpip/usr/samples/heartbeat_mon/stop_heartbeat_mon.sh 1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2008 
# 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 
#
# This script stops the heartbeat monitor daemon and removes its entry from
# inittab
#

# Remove heartbeat monitor daemon from inittab
rmitab heartbeat_mon > /dev/null 2>&1

# Get the pid of heartbeat_mon and kill it
LANG=C pid=`ps -e | grep heartbeat_mon | sed -e 's/^  *//' -e 's/ .*//' &&[ ! -z "$pid" ]`

if [[ -n $pid ]]; then
    kill -KILL ${pid} > /dev/null 2>&1
    if [ $? -ne 0 ]; then
        exit 0
    fi
fi

