linamh/net-analyzer/net-snmp/files/snmpd.init
geos_one 79a12a36fd bump patch
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1562 6952d904-891a-0410-993b-d76249ca496b
2009-10-17 05:31:09 +00:00

48 lines
1.0 KiB
Plaintext

#!/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 $?
}