252N/A#
252N/A# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
252N/A#
252N/A# ident "@(#)masfd 1.5 03/06/25 SMI"
252N/A
252N/ASUNWMASF_PKGLIB=`pkgparam SUNWmasf BASEDIR`
252N/ASNMPD=$SUNWMASF_PKGLIB/SUNWmasf/sbin/snmpd
252N/ASUNWMASF_PKGLIB=$SUNWMASF_PKGLIB/SUNWmasf/lib
252N/ACONF_FILE=/etc/opt/SUNWmasf/conf/snmpd.conf
252N/ATIMEOUT=5
252N/A
252N/Aif [ ! -f ${CONF_FILE} ]; then
252N/A exit 0
252N/Afi
252N/A
252N/Aexport SUNWMASF_PKGLIB
252N/A
252N/APATTERN=`echo $SNMPD | sed 's/\\//\\\\\\//g'`
252N/A
252N/Ais_running() {
252N/A /usr/bin/pgrep -x -f "$PATTERN -X"> /dev/null 2>&1
252N/A}
252N/A
252N/Acase "$1" in
252N/Astart)
252N/A if is_running ; then
252N/A echo "Agent already running" >&2
252N/A exit 1
252N/A else
252N/A {
252N/A # allow time for agentX master agent to open socket
252N/A sleep 30
252N/A $SNMPD -X > /dev/null 2>&1
252N/A } &
252N/A fi
252N/A ;;
252N/Astop)
252N/A TIME=0
252N/A /usr/bin/pkill -x -f "$PATTERN -X"
252N/A # Allow time for final poll to complete, before relinquishing control
252N/A # and allowing picld to be stopped
252N/A while is_running && [ $TIME -lt $TIMEOUT ] ; do
252N/A sleep 1
252N/A TIME=`/usr/bin/expr $TIME + 1`
252N/A done
252N/A ;;
252N/A*)
252N/A echo "Usage: $0 {start|stop}" >&2
252N/A exit 1
252N/A ;;
252N/Aesac
252N/A
252N/Aexit 0