1
0

pianod.init 837 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2015 OpenWrt.org
  3. NAME=pianod
  4. START=95
  5. USE_PROCD=1
  6. PD_USER=$NAME
  7. PD_STARTSCRIPT=/etc/$NAME/startscript
  8. PD_PASSWDFILE=/etc/$NAME/users
  9. PD_WEBUI=/www/$NAME
  10. start_service() {
  11. # Take group ownership of audio devices
  12. chown root:$NAME /dev/snd/* /dev/mixer /dev/dsp
  13. chmod 664 /dev/snd/* /dev/mixer /dev/dsp
  14. procd_open_instance
  15. procd_set_param command "/usr/bin/$NAME"
  16. procd_append_param command -n $PD_USER
  17. procd_append_param command -i "$PD_STARTSCRIPT"
  18. procd_append_param command -u "$PD_PASSWDFILE"
  19. [ -d "$PD_WEBUI" ] && procd_append_param command -c "$PD_WEBUI"
  20. # No HTTPS support without certificates
  21. procd_append_param command -s 0
  22. procd_close_instance
  23. }
  24. # Wait for service to exit and release sockets
  25. reload_service() {
  26. stop
  27. sleep 2
  28. start
  29. }
  30. restart() {
  31. reload_service
  32. }