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 DAEMON_ARGS="--dsp-slave=/usr/lib/osspd/ossp-slave"
21 PIDFILE=/var/run/$NAME.pid
22 SCRIPTNAME=/etc/init.d/$NAME
24 # Exit if the package is not installed
25 [ -x "$DAEMON" ] || exit 0
27 # Define LSB log_* functions.
28 . /lib/lsb/init-functions
31 # Function that starts the daemon/service
35 modprobe cuse # make sure the cuse module is loaded
37 # 0 if daemon has been started
38 # 1 if daemon was already running
39 # 2 if daemon could not be started
40 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --test > /dev/null \
42 # -f: run in foreground, start-stop-daemon does the forking - this is required to let start-stop-daemon handle the pidfile
43 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- -f \
49 # Function that stops the daemon/service
54 # 0 if daemon has been stopped
55 # 1 if daemon was already stopped
56 # 2 if daemon could not be stopped
57 # other if a failure occurred
58 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
64 log_daemon_msg "Starting $DESC" "$NAME"
72 log_daemon_msg "Stopping $DESC" "$NAME"
80 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
83 log_daemon_msg "Restarting $DESC" "$NAME"
90 1) log_end_msg 1 ;; # Old process is still running
91 *) log_end_msg 1 ;; # Failed to start
101 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2