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
|
|
|
|
#
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
start() {
|
|
|
|
echo -n $"Starting $prog: "
|
|
|
|
daemon /usr/sbin/snmptrapd $OPTIONS
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
touch /var/lock/subsys/snmptrapd
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
echo -n $"Stopping $prog: "
|
|
|
|
killproc /usr/sbin/snmptrapd
|
|
|
|
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
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
|
|
condrestart
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status snmptrapd
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
|
|
|
RETVAL=1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|