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="-f" # run in foreground, start-stop-daemon does the forking: required to let start-stop-daemon handle the pidfile
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 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
29 # and status_of_proc is working.
30 . /lib/lsb/init-functions
33 # Function that starts the daemon/service
37 modprobe cuse # make sure the cuse module is loaded
39 # 0 if daemon has been started
40 # 1 if daemon was already running
41 # 2 if daemon could not be started
42 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --test > /dev/null \
44 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- -f \
50 # Function that stops the daemon/service
55 # 0 if daemon has been stopped
56 # 1 if daemon was already stopped
57 # 2 if daemon could not be stopped
58 # other if a failure occurred
59 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
65 log_daemon_msg "Starting $DESC" "$NAME"
73 log_daemon_msg "Stopping $DESC" "$NAME"
81 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
84 log_daemon_msg "Restarting $DESC" "$NAME"
91 1) log_end_msg 1 ;; # Old process is still running
92 *) log_end_msg 1 ;; # Failed to start
102 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2