#!/bin/sh -e
# Start/stop the newscache daemon.

test -f /usr/sbin/NewsCache || exit 0
test -f /etc/newscache.conf || exit 0

case "$1" in
start)  echo -n "Starting usenet cache daemon: newscache"
        start-stop-daemon --start --quiet --exec /usr/sbin/NewsCache >/dev/null 2>&1
        echo "." 
        ;;
stop)   echo -n "Stopping usenet cache daemon: newscache"
        start-stop-daemon --stop --signal 9 --quiet --exec /usr/sbin/NewsCache
        echo "."
        ;;
reload|force-reload|restart) echo -n "Re-starting usenet cache daemon: newscache"
        start-stop-daemon --stop --signal 9 --quiet --exec /usr/sbin/NewsCache
        start-stop-daemon --start --quiet --exec /usr/sbin/NewsCache >/dev/null 2>&1
        echo "."
        ;;
*)      echo "Usage: /etc/init.d/newscache start|stop|reload|force-reload|restart"; exit 1 
        ;;
esac
exit 0
