blob: d8419eaa69c768f260cf886abe5a414473dce054 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.init,v 1.1 2009/10/16 08:51:05 gengor Exp $
opts="${opts} reload"
depend() {
use logger
need net
}
SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}"
checkconfig() {
if [ ! -e /etc/snmp/snmpd.conf ] ; then
eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet --exec /usr/sbin/snmpd \
-- -p ${SNMPD_PIDFILE} ${SNMPD_FLAGS}
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --pidfile ${SNMPD_PIDFILE}
eend $?
}
reload() {
checkconfig || return 1
if [ ! -f ${SNMPD_PIDFILE} ]; then
eerror "Cannot reload configuration, ${SVCNAME} is not running"
eend 1
return 1
fi
ebegin "Reloading ${SVCNAME} configuration"
kill -HUP $(< ${SNMPD_PIDFILE}) &>/dev/null
eend $?
}
|