5 kx #!/bin/sh
5 kx #
5 kx # Start/stop/restart PulseAudio in system mode.
5 kx # In this mode, a single system instance of PulseAudio will be shared by
5 kx # multiple local users.
5 kx #
5 kx # Please note: this is not generally the best way to use PulseAudio!
5 kx # Normally pulseaudio will start automatically as-needed with an instance
5 kx # per audio user. Unless you really need to use system mode you should leave
5 kx # this script non-executable.
5 kx #
5 kx # For more information, see:
5 kx # http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide
5 kx
5 kx pulse_start() {
5 kx if [ -x /usr/bin/pulseaudio ]; then
5 kx echo "Starting system PulseAudio daemon: /usr/bin/pulseaudio --system --disallow-module-loading &"
5 kx rm -rf /var/lib/pulse
5 kx # Any errors/warnings will go to the log files:
5 kx /usr/bin/pulseaudio --system --disallow-module-loading 1> /dev/null 2> /dev/null &
5 kx fi
5 kx }
5 kx
5 kx pulse_stop() {
5 kx echo "Stopping PulseAudio: /bin/killall pulseaudio"
5 kx /bin/killall pulseaudio 2> /dev/null
5 kx }
5 kx
5 kx pulse_restart() {
5 kx pulse_stop
5 kx sleep 1
5 kx pulse_start
5 kx }
5 kx
5 kx case "$1" in
5 kx 'start')
5 kx pulse_start
5 kx ;;
5 kx 'stop')
5 kx pulse_stop
5 kx ;;
5 kx 'restart')
5 kx pulse_restart
5 kx ;;
5 kx *)
5 kx echo "usage $0 start|stop|restart"
5 kx esac