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
36 # 0 if daemon has been started
37 # 1 if daemon was already running
38 # 2 if daemon could not be started
39 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --test > /dev/null \
41 # -f: run in foreground, start-stop-daemon does the forking - this is required to let start-stop-daemon handle the pidfile
42 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- -f \
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