From e6520cf249ccf403a6bc548b7735615f13280212 Mon Sep 17 00:00:00 2001 From: Eric Luehrsen Date: Sat, 25 Mar 2017 01:53:28 -0400 Subject: 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 --- net/unbound/files/unbound.init | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'net/unbound/files/unbound.init') diff --git a/net/unbound/files/unbound.init b/net/unbound/files/unbound.init index e4b7ec85f..1edf9ef80 100755 --- a/net/unbound/files/unbound.init +++ b/net/unbound/files/unbound.init @@ -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 } ############################################################################## -- cgit v1.2.3