From 8830d72bbd8882b89a9d42047c31088ac8e76265 Mon Sep 17 00:00:00 2001 From: Eric Luehrsen Date: Tue, 31 Jul 2018 22:59:24 -0400 Subject: unbound: fix boot time and default run directory Unbound struggles with boot ifup, so procd triggers changed to push outside of this noise. Unbound has run in /var/lib/unbound/, so chroot (jail) protects /etc/, and it can save flash wear. Compiled defaults reflect this now, so Unbound tools are easier run on the command line. Signed-off-by: Eric Luehrsen --- net/unbound/files/unbound.init | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'net/unbound/files/unbound.init') diff --git a/net/unbound/files/unbound.init b/net/unbound/files/unbound.init index f12e6831c..ff827c4f0 100755 --- a/net/unbound/files/unbound.init +++ b/net/unbound/files/unbound.init @@ -54,22 +54,31 @@ stop_service() { ############################################################################## service_triggers() { - local trigger local legacy=$( uci_get unbound.@unbound[0].trigger ) local triggers=$( uci_get unbound.@unbound[0].trigger_interface ) + local trigger="$triggers $legacy" - triggers="$triggers $legacy" - PROCD_RELOAD_DELAY=2000 - procd_add_reload_trigger "unbound" + . /usr/lib/unbound/defaults.sh + + + if [ ! -f "$UB_TOTAL_CONF" -o -n "$UB_BOOT" ] ; then + # Unbound is can be a bit heavy, so wait some on first start but any + # interface coming up affects the trigger and delay so guarantee start + procd_add_raw_trigger "interface.*.up" 5000 /etc/init.d/unbound restart + + elif [ -n "$triggers" ] ; then + PROCD_RELOAD_DELAY=2000 + procd_add_reload_trigger "unbound" "dhcp" - if [ -n "$triggers" ] ; then for trigger in $triggers ; do - # due to some netifd/procd interactions with IP6, limit interfaces + # User selected triggers to restart at any other time procd_add_reload_interface_trigger "$trigger" done + else - procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload + PROCD_RELOAD_DELAY=2000 + procd_add_reload_trigger "unbound" "dhcp" fi } -- cgit v1.2.3