File snmpd-isst of Package net-snmp-5.4.2.1-isst

#!/bin/bash
# ucd-snmp init file for snmpd
#
# chkconfig: - 50 50
# description: Custom Simple Network Management Protocol (SNMP) Daemon
#
# processname: /opt/comcast/snmp/sbin/snmpd
# config: /opt/comcast/snmp/etc/snmpd.conf
# pidfile: /var/run/snmpd-custom

# source function library
. /etc/init.d/functions

if [ -e /opt/comcast/snmp/etc/snmpd-custom.options ]; then
  . /opt/comcast/snmp/etc/snmpd-custom.options
else
   OPTIONS="-Lsd -Lf /var/log/snmpd.log -p /var/run/snmpd-custom.pid -a"
fi

RETVAL=0
prog="snmpd-custom"

start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                /opt/comcast/snmp/sbin/snmpd \
                       -c /opt/comcast/snmp/etc/snmpd.conf \
                       $OPTIONS &
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd-custom
        fi;
        echo 
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                pkill -f /opt/comcast/snmp/sbin/snmpd
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd-custom
        fi;
        echo
        return $RETVAL
}

reload(){
        echo -n $"Reloading $prog: "
        killproc /opt/comcast/snmp/sbin/snmpd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

restart(){
	stop
	start
}

condrestart(){
    [ -e /var/lock/subsys/snmpd-custom ] && restart
    return 0
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	restart
        ;;
  reload)
	reload
        ;;
  condrestart)
	condrestart
	;;
  status)
        status snmpd
	RETVAL=$?
        ;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
	RETVAL=1
esac

exit $RETVAL
openSUSE Build Service is sponsored by