You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.9 KiB

  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. START=19
  12. STOP=50
  13. USE_PROCD=1
  14. PROG=/usr/sbin/unbound
  15. ##############################################################################
  16. . /usr/lib/unbound/unbound.sh
  17. ##############################################################################
  18. boot() {
  19. UNBOUND_BOOT=1
  20. start "$@"
  21. }
  22. ##############################################################################
  23. start_service() {
  24. if [ -n "$UNBOUND_BOOT" ] ; then
  25. # Load procd triggers (rc) and use event IFUP to really start
  26. return 0
  27. fi
  28. # complex UCI work
  29. unbound_start
  30. # standard procd clause
  31. procd_open_instance
  32. procd_set_param command $PROG -d -c $UNBOUND_CONFFILE
  33. procd_set_param respawn
  34. procd_close_instance
  35. }
  36. ##############################################################################
  37. stop_service() {
  38. unbound_stop
  39. # Wait! on restart Unbound may take time writing closure stats to syslog
  40. pidof $PROG && sleep 1
  41. }
  42. ##############################################################################
  43. service_triggers() {
  44. local trigger
  45. local triggers=$( uci_get unbound.@unbound[0].trigger )
  46. PROCD_RELOAD_DELAY=2000
  47. procd_add_reload_trigger "unbound"
  48. if [ -n "$triggers" ] ; then
  49. for trigger in $triggers ; do
  50. # due to some netifd/procd interactions with IP6, limit interfaces
  51. procd_add_reload_interface_trigger "$trigger"
  52. done
  53. else
  54. procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload
  55. fi
  56. }
  57. ##############################################################################