User Guide

A-10 SNMP Installation, Operation, and Definition
Copyright © 2001, 2003 by LSI Logic Corporation. All rights reserved.
A.6.2 Example of /etc/rc.d/init.d/snmpd File
The following is an example of the /etc/rc.d/init.d/snmpd file from Red Hat
Linux which has been modified to use the above configuration:
#!/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
# pidfile: /var/run/snmpd
# source function library
#this is for the function of killproc etc.
. /etc/init.d/functions
#This library may fail to load on some of the Linux flavors.
#If the failure happens, comment the above line,
#and change the killproc lines in stop() to
# pids=‘$PS | grep snmpd | grep -v grep | awk ’{ print $1}’‘
# [ “$pids” ] $$ kill $pids
# pids=‘$PS | grep snmptrapd | grep -v grep | awk ’{ print
$1}’‘
OPTIONS=”-s -l /dev/null -P /var/run/snmpd -a”
RETVAL=0
Prog=”snmpd”
start() {
echo -n $"Starting $prog: "
/usr/local/sbin/snmpd -c /usr/share/snmp/snmpd.conf -C
$OPTIONS
/usr/local/sbin/snmptrapd -o /var/log/snmptrap.log
RETVAL=$?
ECHO
touch /var/lock/subsys/snmpd
return $RETVAL
}
stop() {
echo -n "Shutting $prog: "
killproc /usr/local/sbin/snmpd
killproc /usr/local/sbin/snmptrapd