net-snmp/debian/snmpd.init

49 lines
1.1 KiB
Bash

#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: snmpd
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SNMP agents
# Description: NET SNMP (Simple Network Management Protocol) Agents
### END INIT INFO
#
# Author: Jochen Friedrich <jochen@scram.de>
#
DESC="SNMP Services"
DAEMON=/usr/sbin/snmpd
PIDFILE="/run/snmpd.pid"
DEFAULT_SNMPDOPTS="-LSwd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf"
set_daemon_options()
{
[ -z "$SNMPDOPTS" ] && SNMPDOPTS=$DEFAULT_SNMPDOPTS
DAEMON_ARGS="$SNMPDOPTS -p $PIDFILE"
}
do_restart_prepare()
{
set_daemon_options
}
do_start_prepare()
{
set_daemon_options
# remove old symlink with previous version
if [ -L /var/run/agentx ]; then
rm -f /var/run/agentx
fi
if [ ! -d /var/run/agentx ]; then
mkdir -p /var/run/agentx
fi
}