64 lines
1.3 KiB
Plaintext
64 lines
1.3 KiB
Plaintext
|
#! /bin/bash
|
||
|
#
|
||
|
# snmpd -- start/stop the Simple Network Management Protocol daemon
|
||
|
# chkconfig: 2345 55 15
|
||
|
# description: Simple Network Management Protocol
|
||
|
# processname: snmp
|
||
|
# pidfile: /var/run/snmp.pid
|
||
|
# config: /etc/net-snmp/snmpd.conf
|
||
|
|
||
|
# source function library
|
||
|
. /etc/sysconfig/rc
|
||
|
. $rc_functions
|
||
|
|
||
|
NAME=snmpd
|
||
|
DAEMON=/usr/sbin/$NAME
|
||
|
DAEMONPID=/var/run/$NAME.pid
|
||
|
DAEMONCONF=/etc/net-snmp/snmpd.conf
|
||
|
DAEMONLOG=/var/log/snmpd.log
|
||
|
OPTIONS="-Lsd -Lf $DAEMONLOG -c $DAEMONCONF -p $DAEMONPID -a"
|
||
|
|
||
|
[ -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
|