rc.pulseaudio 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. start()
  3. {
  4. if /usr/bin/sudo -u pulse /usr/bin/pulseaudio --check; then
  5. echo "pulseaudio is running."
  6. else
  7. echo "Starting pulseaudio..."
  8. /usr/bin/sudo -u pulse /usr/bin/pulseaudio --start --use-pid-file=yes
  9. fi
  10. }
  11. stop()
  12. {
  13. if /usr/bin/sudo -u pulse /usr/bin/pulseaudio --check; then
  14. printf "Stopping pulseaudio..."
  15. /usr/bin/sudo -u pulse /usr/bin/pulseaudio --kill
  16. while /usr/bin/sudo -u pulse /usr/bin/pulseaudio --check; do
  17. printf "."
  18. sleep 1
  19. done
  20. echo "Done"
  21. else
  22. echo "pulseaudio is not running."
  23. fi
  24. }
  25. status()
  26. {
  27. if /usr/bin/sudo -u pulse /usr/bin/pulseaudio --check; then
  28. echo "pulseaudio is running."
  29. else
  30. echo "pulseaudio is not running."
  31. fi
  32. }
  33. case "$1" in
  34. 'start')start;;
  35. 'stop')stop;;
  36. 'restart')stop;start;;
  37. 'status')status;;
  38. *)echo "$0 start|stop|restart|status"
  39. esac