64 lines
1.4 KiB
Bash
64 lines
1.4 KiB
Bash
#! /bin/bash
|
|
#
|
|
# snmptrapd -- start/stop the Simple Network Management Protocol Trap daemon
|
|
# chkconfig: 2345 55 15
|
|
# description: Simple Network Management Protocol TRAP and INFORM messages
|
|
# processname: snmptrapd
|
|
# pidfile: /var/run/snmptrapd.pid
|
|
# config: /etc/net-snmp/snmptrapd.conf
|
|
|
|
# source function library
|
|
. /etc/sysconfig/rc
|
|
. $rc_functions
|
|
|
|
NAME=snmptrapd
|
|
DAEMON=/usr/sbin/$NAME
|
|
DAEMONPID=/var/run/$NAME.pid
|
|
DAEMONCONF=/etc/net-snmp/snmptrapd.conf
|
|
DAEMONLOG=/var/log/snmptrapd.log
|
|
OPTIONS="-Lf $DAEMONLOG -c $DAEMONCONF -p $DAEMONPID"
|
|
|
|
[ -x $DAEMON ] || exit 0
|
|
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
|
|
|
# check if the snmpd conf file is present
|
|
[ -r $DAEMONCONF ] || exit 0
|
|
|
|
RETVAL=0
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n $"Starting $NAME: "
|
|
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
|
|
;;
|
|
stop)
|
|
echo -n $"Stopping $NAME: "
|
|
killproc -p $DAEMONPID $DAEMON
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID
|
|
;;
|
|
restart|force-reload|reload)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
condrestart)
|
|
[ -e /var/lock/subsys/$NAME ] && $0 restart
|
|
;;
|
|
status)
|
|
statusproc $DAEMON
|
|
RETVAL=$?
|
|
;;
|
|
*)
|
|
echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|restart|condrestart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit $RETVAL
|