packages/net/unbound/files/unbound.init
Eric Luehrsen afa56a6002 unbound: fix hotplug iface and ntp restarts
Unbound is configured to restart on hotplug/iface but this can result
in numerous restarts at boot. Unbound also has a restart for NTP.
This was observed to generate trouble and even with procd robustness
too many crashes might occur (rare). Unbound would not be running.

Give more care to /var/lib/unbound/root.key during restarts. Use procd
for iface restarts. Check pidof() to wait one more second for Unbound.

Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
2017-03-17 23:16:49 -04:00

50 lines
1.3 KiB
Bash
Executable file

#!/bin/sh /etc/rc.common
##############################################################################
#
# Copyright (C) 2016 Michael Hanselmann, Eric Luehrsen
#
##############################################################################
#
# This init script is just the entry point for Unbound UCI.
#
##############################################################################
START=60
USE_PROCD=1
PROG=/usr/sbin/unbound
##############################################################################
. /usr/lib/unbound/unbound.sh
##############################################################################
start_service() {
# WAIT! Unbound often takes its time writing closure stats to syslog
pidof $PROG && sleep 1
# complex UCI work
unbound_start
# standard procd clause
procd_open_instance
procd_set_param command $PROG -d -c $UNBOUND_CONFFILE
procd_set_param respawn
procd_close_instance
}
##############################################################################
stop_service() {
unbound_stop
}
##############################################################################
service_triggers() {
procd_add_reload_trigger "unbound"
procd_add_raw_trigger "interface.*" 2000 /etc/init.d/unbound restart
}
##############################################################################