#! /bin/sh
# Copyright (c) 1996 SuSE Gmbh Fuerth, Germany.  All rights reserved.
#
# Author: Remo Behn <ray@suse.de>, 2000
#
# /etc/init.d/snmpd
#
### BEGIN INIT INFO
# Provides:            ucdsnmp snmp
# Required-Start:      $network
# Required-Stop:
# Default-Start:       2 3 5
# Default-Stop:        0 1 6
# Description:         start ucd-snmpd
### END INIT INFO

. /etc/rc.config

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_SNMPD=yes
test "$START_SNMPD" = yes || exit 0

# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
    start)
	echo -n "Starting snmpd:"
	startproc /usr/sbin/snmpd || return=$rc_failed
	echo -e "$return"
	;;
    stop)
	echo -n "Shutting down snmpd:"
	killproc -TERM /usr/sbin/snmpd || return=$rc_failed
	echo -e "$return"
	;;
    restart|reload)
	$0 stop  &&  $0 start  ||  return=$rc_failed
	;;
    status)
	echo -n "Checking for service snmpd: "
	checkproc /usr/sbin/snmpd && echo OK || echo No process
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 1
	;;
esac

# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0

