Blame SOURCES/net-snmptrapd.init

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