gluon-respondd 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh /etc/rc.common
  2. USE_PROCD=1
  3. START=50
  4. DAEMON=/usr/bin/respondd
  5. MAXDELAY=10
  6. start_service() {
  7. local ifdump="$(ubus call network.interface dump)"
  8. local meshdevs=$(for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device"); do echo " -i $dev";done;)
  9. local clientdevs=$(for dev in $(echo "$ifdump" | jsonfilter -e "@.interface[@.interface='$(cat /lib/gluon/respondd/client.dev 2>/dev/null)' && @.up=true].device"); do echo " -i $dev -t $MAXDELAY";done;)
  10. procd_open_instance
  11. procd_set_param command $DAEMON -d /usr/lib/respondd -d /lib/gluon/respondd -p 1001 -g ff02::2:1001 $meshdevs $clientdevs -g ff05::2:1001 $clientdevs
  12. procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
  13. procd_set_param stderr 1
  14. procd_close_instance
  15. }
  16. service_triggers() {
  17. local script=$(readlink "$initscript")
  18. local name=$(basename ${script:-$initscript})
  19. procd_open_trigger
  20. procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
  21. procd_close_trigger
  22. }