#!/bin/bash
# cmu-snmp init file for snmptrapd
# WWH -- copied snmpd to snmptrapd and edited...
#
#
# chkconfig: - 41 41
# description: Simple Network Management Protocol (SNMP) Trap Daemon
#
# processname: snmptrapd
# config: 
#
# Notes:
# 1) This should read a file:  /etc/snmptrapd.conf
# 2) This is based on /etc/rc.d/init.d/snmpd
# 3) Starting snmptrapd should be via "daemon" but
#    doing so never returns....
# 
# Configuration items:
# A) LOCKFILE -- where the lock for this item should go
#                typically /var/lock/subsys/snmptrapd 
LOCKFILE=/var/lock/subsys/snmptrapd

# D) SDAEMON  -- daemon to start
#                typically /usr/bin/snmptrapd
SDAEMON=/usr/sbin/snmptrapd

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

case "$1" in
  start)
	echo -n "Starting snmptrapd: "
        $SDAEMON -s &
	touch $LOCKFILE
	echo
	;;
  stop)
	echo -n "Shutting down snmptrapd: "
	killproc snmptrapd
	rm -f $LOCKFILE
	echo
	;;
  restart)
        $0 stop
        $0 start
        ;;
  status)
        status snmptrapd
        ;;
  *)
	echo "Usage: snmptrapd {start|stop|restart|status}"
	exit 1
esac

exit 0
