Commit 297b6aed authored by Adam Wujek's avatar Adam Wujek

[BUG: #211] rootfs/etc/init.d/snmpd: wait 60 seconds in background

Delay monit start by extra 60 seconds.

The delay of snmpd start was put into background because /etc/init.d/rcK
cannot be started before /etc/init.d/rcS is finished. Such behavior is
implemented in the init.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent ca4839d3
...@@ -16,6 +16,22 @@ start_counter() { ...@@ -16,6 +16,22 @@ start_counter() {
echo "$START_COUNTER" > $COUNTER_FILE echo "$START_COUNTER" > $COUNTER_FILE
} }
snmpd_start() {
# Log source address (-a)
start-stop-daemon -q -p $SNMP_PID -S \
--exec /usr/sbin/snmpd -- $LOG -p $SNMP_PID -a -c $SNMP_CONF
ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
}
start() { start() {
echo -n "Starting snmpd daemon: " echo -n "Starting snmpd daemon: "
...@@ -42,22 +58,13 @@ start() { ...@@ -42,22 +58,13 @@ start() {
# file doesn't exist yet so it's a boot call, delay to avoid spurious # file doesn't exist yet so it's a boot call, delay to avoid spurious
# errors # errors
echo "Delaying the start of snmp daemon" echo "Delaying the start of snmp daemon"
sleep 60 { sleep 60; snmpd_start; } &
return
fi fi
# Log source address (-a) # start snmpd without delay
start-stop-daemon -q -p $SNMP_PID -S \ snmpd_start
--exec /usr/sbin/snmpd -- $LOG -p $SNMP_PID -a -c $SNMP_CONF
ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
} }
stop() { stop() {
......
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
set init set init
#if "set init" don't run as daemon. "set daemon" only specify interval #if "set init" don't run as daemon. "set daemon" only specify interval
set daemon 10 # check services at 10 seconds intervals, set daemon 10 # check services at 10 seconds intervals,
with start delay 30 # optional: delay the first check by 30 seconds (by with start delay 90 # optional: delay the first check by 90 seconds (by
# # default Monit check immediately after Monit start) # # default Monit check immediately after Monit start)
# # Wait extra 60 seconds to give snmpd time to start
# #
# #
## Set syslog logging with the 'daemon' facility. If the FACILITY option is ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment