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