|
|
@ -2,12 +2,10 @@ |
|
|
|
# Copyright (C) 2008 OpenWrt.org |
|
|
|
START=50 |
|
|
|
|
|
|
|
OPTIONS="-Lf /dev/null -p /var/run/snmpd.pid" |
|
|
|
LIB_D=/var/lib/snmp |
|
|
|
LOG_D=/var/log |
|
|
|
RUN_D=/var/run |
|
|
|
PID_F=$RUN_D/snmpd.pid |
|
|
|
RUN_C=$RUN_D/snmpd.conf |
|
|
|
USE_PROCD=1 |
|
|
|
PROG="/usr/sbin/snmpd" |
|
|
|
|
|
|
|
RUN_C="/var/run/snmpd.conf" |
|
|
|
|
|
|
|
snmpd_agent_add() { |
|
|
|
local cfg="$1" |
|
|
@ -129,11 +127,11 @@ snmpd_disk_add() { |
|
|
|
[ -n "$size" ] || return 0 |
|
|
|
echo "$disk $partition $size" >> $RUN_C |
|
|
|
} |
|
|
|
start() { |
|
|
|
[ -d $LIB_D ] || mkdir -p $LIB_D |
|
|
|
[ -d $LOG_D ] || mkdir -p $LOG_D |
|
|
|
[ -d $RUN_D ] || mkdir -p $RUN_D |
|
|
|
[ -f $RUN_C ] && rm -f $RUN_C |
|
|
|
|
|
|
|
start_service() { |
|
|
|
[ -f "$RUN_C" ] && rm -f "$RUN_C" |
|
|
|
|
|
|
|
procd_open_instance |
|
|
|
|
|
|
|
config_load snmpd |
|
|
|
|
|
|
@ -148,9 +146,13 @@ start() { |
|
|
|
config_foreach snmpd_exec_add exec |
|
|
|
config_foreach snmpd_disk_add disk |
|
|
|
|
|
|
|
$DEBUG /usr/sbin/snmpd $OPTIONS |
|
|
|
procd_set_param command $PROG -Lf /dev/null -f |
|
|
|
procd_set_param file $RUN_C |
|
|
|
procd_set_param respawn |
|
|
|
|
|
|
|
procd_close_instance |
|
|
|
} |
|
|
|
stop() { |
|
|
|
[ -f $PID_F ] && kill $(cat $PID_F) |
|
|
|
[ -f $RUN_C ] && rm -f $RUN_C |
|
|
|
|
|
|
|
stop_service() { |
|
|
|
[ -f "$RUN_C" ] && rm -f "$RUN_C" |
|
|
|
} |