lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

unbound.init (1665B)


      1 #!/bin/sh /etc/rc.common
      2 ##############################################################################
      3 #
      4 # Copyright (C) 2016 Michael Hanselmann, Eric Luehrsen
      5 #
      6 ##############################################################################
      7 #
      8 # This init script is just the entry point for Unbound UCI.
      9 #
     10 ##############################################################################
     11 
     12 START=19
     13 STOP=50
     14 USE_PROCD=1
     15 PROG=/usr/sbin/unbound
     16 
     17 ##############################################################################
     18 
     19 . /usr/lib/unbound/unbound.sh
     20 
     21 ##############################################################################
     22 
     23 boot() {
     24   UNBOUND_BOOT=1
     25   start "$@"
     26 }
     27 
     28 ##############################################################################
     29 
     30 start_service() {
     31   if [ -n "$UNBOUND_BOOT" ] ; then
     32     # Load procd triggers (rc) and use event IFUP to really start
     33     return 0
     34   fi
     35 
     36   # complex UCI work
     37   unbound_start
     38 
     39   # standard procd clause
     40   procd_open_instance
     41   procd_set_param command $PROG -d -c $UNBOUND_CONFFILE
     42   procd_set_param respawn
     43   procd_close_instance
     44 }
     45 
     46 ##############################################################################
     47 
     48 stop_service() {
     49   unbound_stop
     50   
     51   # Wait! on restart Unbound may take time writing closure stats to syslog
     52   pidof $PROG && sleep 1
     53 }
     54 
     55 ##############################################################################
     56 
     57 service_triggers() {
     58   # use soft reload to prevent continuous stop-start and cache flush
     59   procd_add_reload_trigger "unbound"
     60   procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload
     61 }
     62 
     63 ##############################################################################
     64