2004-09-09 09:10:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# ucd-snmp init file for snmpd
|
|
|
|
#
|
|
|
|
# chkconfig: - 50 50
|
|
|
|
# description: Simple Network Management Protocol (SNMP) Daemon
|
|
|
|
#
|
|
|
|
# processname: /usr/sbin/snmpd
|
|
|
|
# config: /etc/snmp/snmpd.conf
|
|
|
|
# config: /usr/share/snmp/snmpd.conf
|
2007-06-25 09:33:00 +00:00
|
|
|
# pidfile: /var/run/snmpd.pid
|
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/snmpd.options ]; then
|
|
|
|
. /etc/snmp/snmpd.options
|
|
|
|
else
|
2006-10-25 07:38:35 +00:00
|
|
|
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
|
2006-07-12 12:32:23 +00:00
|
|
|
fi
|
|
|
|
|
2004-09-09 09:10:41 +00:00
|
|
|
RETVAL=0
|
|
|
|
prog="snmpd"
|
|
|
|
|
|
|
|
start() {
|
|
|
|
echo -n $"Starting $prog: "
|
|
|
|
if [ $UID -ne 0 ]; then
|
|
|
|
RETVAL=1
|
|
|
|
failure
|
|
|
|
else
|
|
|
|
daemon /usr/sbin/snmpd $OPTIONS
|
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
|
|
|
|
fi;
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
echo -n $"Stopping $prog: "
|
|
|
|
if [ $UID -ne 0 ]; then
|
|
|
|
RETVAL=1
|
|
|
|
failure
|
|
|
|
else
|
|
|
|
killproc /usr/sbin/snmpd
|
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
|
|
|
|
fi;
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
reload(){
|
|
|
|
echo -n $"Reloading $prog: "
|
|
|
|
killproc /usr/sbin/snmpd -HUP
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
restart(){
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
condrestart(){
|
|
|
|
[ -e /var/lock/subsys/snmpd ] && restart
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
|
|
condrestart
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status snmpd
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
|
|
|
RETVAL=1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|