Blame SOURCES/net-snmptrapd.init

8a419f
#!/bin/bash
8a419f
8a419f
# ucd-snmp init file for snmptrapd
8a419f
#
8a419f
# chkconfig: - 50 50
8a419f
# description: Simple Network Management Protocol (SNMP) Trap Daemon
8a419f
#
8a419f
# processname: /usr/sbin/snmptrapd
8a419f
# config: /etc/snmp/snmptrapd.conf
8a419f
# config: /usr/share/snmp/snmptrapd.conf
8a419f
# pidfile: /var/run/snmptrapd.pid
8a419f
8a419f
8a419f
### BEGIN INIT INFO
8a419f
# Provides: snmptrapd
8a419f
# Required-Start: $local_fs $network
8a419f
# Required-Stop: $local_fs $network
8a419f
# Should-Start:
8a419f
# Should-Stop:
8a419f
# Default-Start:
8a419f
# Default-Stop:
8a419f
# Short-Description: start and stop Net-SNMP trap daemon
8a419f
# Description: Simple Network Management Protocol (SNMP) trap daemon
8a419f
### END INIT INFO
8a419f
8a419f
# source function library
8a419f
. /etc/init.d/functions
8a419f
8a419f
OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
8a419f
if [ -e /etc/sysconfig/snmptrapd ]; then
8a419f
  . /etc/sysconfig/snmptrapd
8a419f
fi
8a419f
8a419f
RETVAL=0
8a419f
prog="snmptrapd"
8a419f
binary=/usr/sbin/snmptrapd
8a419f
pidfile=/var/run/snmptrapd.pid
8a419f
8a419f
start() {
8a419f
	[ -x $binary ] || exit 5
8a419f
	echo -n $"Starting $prog: "
8a419f
        daemon --pidfile=$pidfile /usr/sbin/snmptrapd $OPTIONS
8a419f
	RETVAL=$?
8a419f
	echo
8a419f
	touch /var/lock/subsys/snmptrapd
8a419f
	return $RETVAL
8a419f
}
8a419f
8a419f
stop() {
8a419f
	echo -n $"Stopping $prog: "
8a419f
	killproc -p $pidfile /usr/sbin/snmptrapd
8a419f
	RETVAL=$?
8a419f
	echo
8a419f
	rm -f /var/lock/subsys/snmptrapd
8a419f
	return $RETVAL
8a419f
}
8a419f
8a419f
reload(){
8a419f
	stop
8a419f
	start
8a419f
}
8a419f
8a419f
restart(){
8a419f
	stop
8a419f
	start
8a419f
}
8a419f
8a419f
condrestart(){
8a419f
    [ -e /var/lock/subsys/snmptrapd ] && restart
8a419f
    return 0
8a419f
}
8a419f
8a419f
case "$1" in
8a419f
  start)
8a419f
	start
8a419f
	RETVAL=$?
8a419f
	;;
8a419f
  stop)
8a419f
	stop
8a419f
	RETVAL=$?
8a419f
	;;
8a419f
  restart)
8a419f
	restart
8a419f
	RETVAL=$?
8a419f
        ;;
8a419f
  reload|force-reload)
8a419f
	reload
8a419f
	RETVAL=$?
8a419f
        ;;
8a419f
  condrestart|try-restart)
8a419f
	condrestart
8a419f
	RETVAL=$?
8a419f
	;;
8a419f
  status)
8a419f
        status snmptrapd
8a419f
	RETVAL=$?
8a419f
        ;;
8a419f
  *)
8a419f
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
8a419f
	RETVAL=2
8a419f
esac
8a419f
8a419f
exit $RETVAL