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.

55 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" ] && {
  19. mkdir -p "$userdata"
  20. chmod 0770 "$userdata"
  21. chown domoticz:domoticz "$userdata"
  22. procd_append_param command -userdata "$userdata"
  23. }
  24. [ -n "$sslcert" -a "${sslwww:-0}" -gt 0 ] && {
  25. procd_append_param command -sslcert "$sslcert"
  26. procd_append_param command -sslwww "$sslwww"
  27. [ -n "$sslkey" ] && procd_append_param command -sslkey "$sslkey"
  28. [ -n "$sslpass" ] && procd_append_param command -sslpass "$sslpass"
  29. } || procd_append_param command -sslwww 0
  30. }
  31. start_service() {
  32. procd_open_instance
  33. procd_set_param command "$PROG"
  34. procd_append_param command -scripts /usr/share/domoticz/scripts/
  35. procd_append_param command -wwwroot /usr/share/domoticz/www/
  36. config_load "domoticz"
  37. config_get_bool disabled "$section" "disabled" 0
  38. [ "$disabled" -gt 0 ] && return 1
  39. config_foreach start_domoticz domoticz
  40. procd_set_param pidfile "$PIDFILE"
  41. procd_set_param respawn
  42. procd_set_param stdout 0
  43. procd_set_param term_timeout 10
  44. procd_set_param user "domoticz"
  45. procd_close_instance
  46. }