components/net-snmp-57/sun/masfd
author David Hollister <david.hollister@oracle.com>
Wed, 12 Oct 2016 14:01:13 -0600
changeset 7094 61352b4e5af5
parent 5867 445e2cf1c845
permissions -rw-r--r--
24797203 OpenStack RBAC profiles allow reading too many files 24797238 keystone RBAC and SMF should point at Apache log files 24797256 cinder RBAC and SMF should point at Apache log files 24830959 horizon RBAC and SMF should point at Apache log files

#
# 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