components/net-snmp/sun/masfd
author John Beck <John.Beck@Oracle.COM>
Fri, 21 Apr 2017 13:14:17 -0700
branchs11u3-sru
changeset 7934 2b9fc4cafd1f
parent 252 ee0fb1eabcbf
permissions -rw-r--r--
25933097 thunderbird/Makefile must drop library/desktop/gdk-pixbuf from REQUIRED_PACKAGES

#
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
#
# ident  "@(#)masfd	1.5 03/06/25 SMI"

SUNWMASF_PKGLIB=`pkgparam SUNWmasf BASEDIR`
SNMPD=$SUNWMASF_PKGLIB/SUNWmasf/sbin/snmpd
SUNWMASF_PKGLIB=$SUNWMASF_PKGLIB/SUNWmasf/lib
CONF_FILE=/etc/opt/SUNWmasf/conf/snmpd.conf
TIMEOUT=5

if [ ! -f ${CONF_FILE} ]; then
	exit 0
fi

export SUNWMASF_PKGLIB

PATTERN=`echo $SNMPD | sed 's/\\//\\\\\\//g'` 

is_running() {
        /usr/bin/pgrep -x -f "$PATTERN -X"> /dev/null 2>&1 
}

case "$1" in
start)
        if is_running ; then
                echo "Agent already running" >&2
                exit 1
        else
		{
                        # allow time for agentX master agent to open socket
			sleep 30
	        	$SNMPD -X > /dev/null 2>&1
		} &
        fi
	;;
stop)
        TIME=0
	/usr/bin/pkill -x -f "$PATTERN -X"
        # Allow time for final poll to complete, before relinquishing control
        # and allowing picld to be stopped
        while is_running && [ $TIME -lt $TIMEOUT ] ; do
                sleep 1
                TIME=`/usr/bin/expr $TIME + 1`
        done
	;;
*)
	echo "Usage: $0 {start|stop}" >&2
	exit 1
	;;
esac

exit 0