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 # Define LSB log_* functions.
27 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
28 # and status_of_proc is working.
29 . /lib/lsb/init-functions
32 # Function that starts the daemon/service
36 modprobe cuse # make sure the cuse module is loaded
38 # 0 if daemon has been started
39 # 1 if daemon was already running
40 # 2 if daemon could not be started
41 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
43 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
48 # Function that stops the daemon/service
53 # 0 if daemon has been stopped
54 # 1 if daemon was already stopped
55 # 2 if daemon could not be stopped
56 # other if a failure occurred
57 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
63 log_daemon_msg "Starting $DESC" "$NAME"
71 log_daemon_msg "Stopping $DESC" "$NAME"
79 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
82 log_daemon_msg "Restarting $DESC" "$NAME"
89 1) log_end_msg 1 ;; # Old process is still running
90 *) log_end_msg 1 ;; # Failed to start
100 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2