#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/lpp/cluster/samples/snmp/fix_snmpdv3_conf.sh 1.2 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2004 
# 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 
# @(#)69	1.2 src/43haes/usr/lpp/cluster/samples/snmp/fix_snmpdv3_conf.sh, hacmp.clsmuxpd, 61haes_r714 3/4/04 22:12:05

######################################################################
# Name: fix_snmpdv3_conf
#
# Description:
#
# this scripts adds the line to /etc/snmpdv3.conf
# to support SNMPv3 with HACMP if it is not there
# and refresh snmpd subsystem
#
#
# Arguments: none
#
# Returns:
#
# 	0       Success
# 	1	Failure
#
######################################################################


SNMPV3CONF="/etc/snmpdv3.conf"

if [ ! -f "$SNMPV3CONF" ]
then
	dspmsg scripts.cat 9685 "File $SNMPV3CONF does not exist\n" $SNMPV3CONF
	return 1
fi
	

SEARCH_LINE=$(grep clsmuxpd_password $SNMPV3CONF | awk '{print $1}')
if [[ "$SEARCH_LINE" != "smux" ]]
then
	print 'smux    1.3.6.1.4.1.2.3.1.2.1.5 clsmuxpd_password' >> /etc/snmpdv3.conf
	dspmsg scripts.cat 9683 "The line was successfully added to $SNMPV3CONF\n" $SNMPV3CONF
	refresh -s snmpd
else
	dspmsg scripts.cat 9684 "The line is already present in $SNMPV3CONF\n" $SNMPV3CONF
fi

return 0




