#!/bin/sh
#
# newscache	This shell script takes care of starting and stopping
#		NewsCache
#
# chkconfig: 2345 86 21
# description: NewsCache is a free cache server for USENET News.
# processname: NewsCache
# config: /etc/newscache/newscache.conf
# pidfile: /var/run/NewsCache.pid

# source function library
. /etc/rc.d/init.d/functions

Daemon=/usr/sbin/NewsCache

case "$1" in
  start)
        echo -n "Starting newscache: "
        if [ -x "$Daemon" ]; then
                daemon --user news $Daemon
        else
                echo "(cannot find $Daemon)"
                exit 0
        fi
        echo
        touch /var/lock/subsys/NewsCache
        ;;
  stop)
        echo -n "Shutting down newscache: "
        killproc $Daemon
        rm -f /var/lock/subsys/NewsCache
        echo
        ;;
  restart)
	# Restart daemon.
	$0 stop
	$0 start
	;;
  status)
	status NewsCache
	;;
  *)
        echo "Usage: newscache {start|stop|restart|status}"
        exit 1
esac

exit 0
