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.

47 lines
1.0 KiB

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