1
0

travelmate.init 855 B

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