4 # Required-Start: $remote_fs $syslog
5 # Required-Stop: $remote_fs $syslog
6 # Default-Start: 2 3 4 5
8 # Short-Description: OSS Proxy Daemon: Userland OSS emulation
9 # Description: Daemon providing a userland implementation of OSS devices.
10 # Currently it supports forwarding OSS sound streams to
11 # PulseAudio and ALSA.
14 # Author: Ralf Jung <post@ralfj.de>
16 PATH=/sbin:/usr/sbin:/bin:/usr/bin
17 DESC=" OSS Proxy Daemon"
19 DAEMON=/usr/sbin/$NAME
20 PIDFILE=/var/run/$NAME.pid
21 SCRIPTNAME=/etc/init.d/$NAME
23 # Exit if the package is not installed
24 [ -x "$DAEMON" ] || exit 0
26 # Read configuration variable file if it is present
27 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
29 # Load the VERBOSE setting and other rcS variables
32 # Define LSB log_* functions.
33 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
34 # and status_of_proc is working.
35 . /lib/lsb/init-functions
38 # Function that starts the daemon/service
42 modprobe cuse # make sure the cuse module is loaded
44 # 0 if daemon has been started
45 # 1 if daemon was already running
46 # 2 if daemon could not be started
47 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
49 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
54 # Function that stops the daemon/service
59 # 0 if daemon has been stopped
60 # 1 if daemon was already stopped
61 # 2 if daemon could not be stopped
62 # other if a failure occurred
63 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
69 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
72 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
73 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
77 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
80 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
81 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
85 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
88 log_daemon_msg "Restarting $DESC" "$NAME"
95 1) log_end_msg 1 ;; # Old process is still running
96 *) log_end_msg 1 ;; # Failed to start
106 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2