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.

54 lines
1.6 KiB

  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. USE_PROCD=1
  4. PROG=/usr/bin/domoticz
  5. PIDFILE=/var/run/domoticz.pid
  6. start_domoticz() {
  7. local section="$1"
  8. local loglevel sslcert sslpass sslwww syslog userdata
  9. config_get loglevel "$section" "loglevel"
  10. config_get sslcert "$section" "sslcert"
  11. config_get sslkey "$section" "sslkey"
  12. config_get sslpass "$section" "sslpass"
  13. config_get sslwww "$section" "sslwww"
  14. config_get syslog "$section" "syslog"
  15. config_get userdata "$section" "userdata"
  16. [ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel"
  17. [ -n "$syslog" ] && procd_append_param command -syslog "$syslog"
  18. [ -n "$userdata" ] && procd_append_param command -userdata "$userdata"
  19. [ -n "$sslcert" -a "${sslwww:-0}" -gt 0 ] && {
  20. procd_append_param command -sslcert "$sslcert"
  21. procd_append_param command -sslwww "$sslwww"
  22. [ -n "$sslkey" ] && procd_append_param command -sslkey "$sslkey"
  23. [ -n "$sslpass" ] && procd_append_param command -sslpass "$sslpass"
  24. } || procd_append_param command -sslwww 0
  25. }
  26. start_service() {
  27. mkdir -p /var/lib/domoticz
  28. chmod 0770 /var/lib/domoticz
  29. chown domoticz:domoticz /var/lib/domoticz
  30. procd_open_instance
  31. procd_set_param command "$PROG"
  32. procd_append_param command -scripts /usr/share/domoticz/scripts/
  33. procd_append_param command -wwwroot /usr/share/domoticz/www/
  34. config_load "domoticz"
  35. config_get_bool disabled "$section" "disabled" 0
  36. [ "$disabled" -gt 0 ] && return 1
  37. config_foreach start_domoticz domoticz
  38. procd_set_param pidfile "$PIDFILE"
  39. procd_set_param respawn
  40. procd_set_param stdout 0
  41. procd_set_param term_timeout 10
  42. procd_set_param user "domoticz"
  43. procd_close_instance
  44. }