#! /bin/sh
#
# init.d/inn	Start/stop the news server.
#
# Version:	init.d/inn  1.21  15-Apr-1998  miquels@cistron.nl
#

test -f /usr/sbin/innd || exit 0

start () {
	start-stop-daemon --quiet --start --user news \
		--pidfile /var/run/innd/innd.pid --startas /etc/news/boot
	sleep 1
}

stop () {
	if [ -f /var/run/innd/innwatch.pid ]
	then
		start-stop-daemon --quiet --stop \
			--pidfile /var/run/innd/innwatch.pid
	fi
	start-stop-daemon --quiet --stop \
		--pidfile /var/run/innd/innd.pid --exec /usr/sbin/innd
}

case "$1" in
	start)
		start
		;;
	stop)
		echo "Stopping news server: innd"
		stop
		;;
	restart|force-reload)
		stop
		sleep 2
		start
		;;
	*)
		echo "Usage: /etc/init.d/inn start|stop|restart|force-reload">&2
		exit 1
		;;
esac

exit 0
