knxd.init 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2016 OpenWrt.org
  3. START=98
  4. STOP=20
  5. PROG=/usr/bin/knxd
  6. USE_PROCD=1
  7. append_bool() {
  8. local section="$1"
  9. local option="$2"
  10. local value="$3"
  11. local _loctmp
  12. local default="$4"
  13. config_get_bool _loctmp "$section" "$option"
  14. [ -z "$_loctmp" ] && _loctmp="$default"
  15. [ "$_loctmp" -gt 0 ] && append params "--$value"
  16. }
  17. append_parm() {
  18. local section="$1"
  19. local option="$2"
  20. local switch="$3"
  21. local _loctmp
  22. local default="$4"
  23. config_get _loctmp "$section" "$option"
  24. [ -z "$_loctmp" ] && _loctmp="$default"
  25. [ -z "$_loctmp" ] && return 0
  26. append params "--$switch=$_loctmp"
  27. }
  28. start_service() {
  29. local options url
  30. config_load knxd
  31. append_parm args eibaddr "eibaddr" "0.0.1"
  32. append_parm args layer2 "layer2"
  33. append_bool args GroupCache "GroupCache" 0
  34. append_parm args daemon "daemon" "/var/log/knxd.log"
  35. append_bool args Discovery "Discovery" 1
  36. append_parm args error "error" # "5"
  37. append_parm args listen_tcp "listen-tcp" "6720"
  38. append_bool args no_emisend_queuing "no-emisend-queuing" 0
  39. append_parm args Name "Name" "OpenWrt"
  40. append_bool args no_tunnel_client_queuing "no-tunnel-client-queuing" 0
  41. append_bool args no_monitor "no-monitor" 0
  42. append_bool args Routing "Routing" 0
  43. append_parm args trace "trace" # "7"
  44. append_bool args tpuarts_ack_all_group "tpuarts-ack-all-group" 0
  45. append_bool args tpuarts_ack_all_individual "tpuarts-ack-all-individual" 0
  46. append_bool args tpuarts_disch_reset "tpuarts-disch-reset" 0
  47. append_bool args Tunnelling "Tunnelling" 1
  48. append_bool args Server "Server" 1
  49. append_parm args listen_local "listen-local" "/var/run/knxd"
  50. config_get url args url
  51. procd_open_instance
  52. procd_set_param command $PROG $params $url
  53. procd_set_param respawn
  54. procd_close_instance
  55. }
  56. stop_service() {
  57. killall knxd
  58. }
  59. reload_service()
  60. {
  61. restart
  62. }
  63. service_triggers()
  64. {
  65. procd_add_reload_trigger knxd
  66. }