unbound: improve interface trigger behavior

procd interface triggers may be busy. Unbound hard restarts will
flush the cache. This might happen frequently depending on how
interface triggers occur.

Change the procd trigger to reduce occurences. Load this trigger
prior to netifd (START=20), but only truly start Unbound from
the trigger rather than immediately in init. Clean up log entries
in scripts after Unbound, NTP, and DNSSEC are established.

Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
This commit is contained in:
Eric Luehrsen
2017-03-25 01:53:28 -04:00
parent eba418ab59
commit 79a48b009f
5 changed files with 53 additions and 13 deletions

View File

@@ -9,7 +9,8 @@
#
##############################################################################
START=60
START=19
STOP=50
USE_PROCD=1
PROG=/usr/sbin/unbound
@@ -19,9 +20,18 @@ PROG=/usr/sbin/unbound
##############################################################################
boot() {
UNBOUND_BOOT=1
start "$@"
}
##############################################################################
start_service() {
# WAIT! Unbound often takes its time writing closure stats to syslog
pidof $PROG && sleep 1
if [ -n "$UNBOUND_BOOT" ] ; then
# Load procd triggers (rc) and use event IFUP to really start
return 0
fi
# complex UCI work
unbound_start
@@ -37,13 +47,17 @@ start_service() {
stop_service() {
unbound_stop
# Wait! on restart Unbound may take time writing closure stats to syslog
pidof $PROG && sleep 1
}
##############################################################################
service_triggers() {
# use soft reload to prevent continuous stop-start and cache flush
procd_add_reload_trigger "unbound"
procd_add_raw_trigger "interface.*" 2000 /etc/init.d/unbound restart
procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload
}
##############################################################################