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.

36 lines
780 B

  1. #!/bin/sh /etc/rc.common
  2. START=85
  3. USE_PROCD=1
  4. trm_init="/etc/init.d/travelmate"
  5. trm_script="/usr/bin/travelmate.sh"
  6. boot()
  7. {
  8. ubus -t 30 wait_for network.interface
  9. rc_procd start_service
  10. }
  11. start_service()
  12. {
  13. if [ $(/etc/init.d/travelmate enabled; printf ${?}) -eq 0 ]
  14. then
  15. procd_open_instance "travelmate"
  16. procd_set_param command "${trm_script}" "${@}"
  17. procd_set_param stdout 1
  18. procd_set_param stderr 1
  19. procd_close_instance
  20. fi
  21. }
  22. service_triggers()
  23. {
  24. local iface="$(uci -q get travelmate.global.trm_iface)"
  25. for name in ${iface}
  26. do
  27. procd_add_interface_trigger "interface.*.down" "${name}" "${trm_init}" start
  28. done
  29. procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start
  30. }