#!/bin/bash . `dirname $0`/functions option config standard_option /var/state/snmpd.conf option template standard_option /usr/share/snmp/snmpd.conf option community standard_option public option location standard_option option contact standard_option option network standard_option 0.0.0.0/0 option listen standard_option 0.0.0.0 option port standard_option 161 option bin reserved_option /usr/sbin/snmpd option cmdline reserved_option '$bin -C -c $opt_config -p $pidfile -M : -m : -LSid' option pidfile reserved_option /var/run/snmpd.pid function fct_pre_start { # If config file is /var/state/snmpd.conf consider it is built from template if [ -n "$opt_template" -a -e "$opt_template" ] ; then if [ -e $opt_config ] && ! grep "^# GENERATED FILE - DO NOT MODIFY" $opt_config ; then echo "Warning $opt_config not generated, bypass template" >&2 else cat $opt_template | sed -e "s^@@network@@^${opt_network}^" \ -e "s^@@community@@^${opt_community}^" \ -e "s^@@listen@@^${opt_listen}^" \ -e "s^@@contact@@^${opt_contact}^" \ -e "s^@@location@@^${opt_location}^" \ -e "s^@@port@@^${opt_port}^" >$opt_config fi fi return 0 } load_config