#!/bin/sh
#
# Start or stop the Jack Detector Daemon.
#
# Written by Francois TOURDE <fr-om@tourde.org>
#


[ -f /etc/default/jdd ] && . /etc/default/jdd

case "$1" in
    start)
        echo -n "Starting jdd daemon: "
        start-stop-daemon -S -x /usr/bin/jdd &
        if [ $? = 0 ]; then
            echo "jdd."
        else
            echo "(failed.)"
        fi
        ;;
    stop)
        echo -n "Stopping jdd daemon: "
        start-stop-daemon -K -x /usr/bin/jdd &
        echo "jdd."
        ;;
    restart|force-reload)
        $0 stop
        $0 start
        exit
        ;;
    *)
        echo "Usage: /etc/init.d/jdd {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0
